User Tools

Site Tools


addons:using_ashitacore

Using AshitaCore Object

What is the AshitaCore Object?

AshitaCore is the IAshitaCore object that is internally created inside of the Ashita.dll hook. It is passed to addons so they can interact with the main hook object. The is the main object to use when you need to interact with the game as well as Ashita itself.

AshitaCore is automatically created for you inside of your addon, so there is no extra steps needed to be done to make use of it. You can simply start using it immediately.


Using AshitaCore

Making use of AshitaCore is very simple and similar to other languages. AshitaCore is created from a class object inside of C++. This means that calls are considered thiscall. What this means is that the calling convention used (thiscall) makes use of an object while making the call to the desired function. For example, take this C++ code:

class Derp
{
public:
    void HelloWorld();
};
 
auto x = new Derp();
x->HelloWorld();
delete x;

This example code shows creating a class called Derp, making an instance of it named 'x', and then invoking the 'HelloWorld' function. Because 'x' is an instance of Derp, we use the → operator to invoke the function. In Lua, → is represented by : instead.

You an learn more about the differences between . and : in Lua here:

In Lua, metatables are used to mimic a style of object-oriented coding.

Lets take for example, inside of the IAshitaCore interface, we have a function:

virtual HWND GetGameHwnd(void) const = 0;

In C++, this would be invoked like this:

auto hWnd = coreObject->GetGameHwnd();

In Lua, we would call it like this:

local hWnd = AshitaCore:GetGameHwnd();

By using the : operator in Lua, we are automatically informing the interpreter that on the left side of the : (in this case, AshitaCore) our object to invoke the GetGameHwnd with is AshitaCore. This can also be called like this:

local hWnd = IAshitaCore.GetGameHwnd(AshitaCore);

However in this case, it is not as elegant as the other.


What's Exposed From AshitaCore?

AshitaCore is a main container that holds several other interface objects. Here is a list of what is exposed to Lua.

You can find more information about these calls and interface information inside of the plugin ADK at:
\Ashita\Plugins\ADK\Ashita.h

  • IAshitaCore
    • GetInstallPath()
    • GetFFXiHwnd()
    • GetHandle()
    • GetFontManager()
    • GetChatManager()
    • GetInputManager()
    • GetPacketManager()
    • GetPluginManager()
    • GetPointerManager()
    • GetResourceManager()
    • GetDataManager()
  • IFontManager
    • CreateFontObject()
    • GetFontObject()
    • DeleteFontObject()
  • IPrimitiveObject
    • GetVisibility()
    • GetPositionX()
    • GetPositionY()
    • GetWidth()
    • GetHeight()
    • GetColor()
    • SetVisibility()
    • SetPositionX()
    • SetPositionY()
    • SetWidth()
    • SetHeight()
    • SetColor()
    • SetTextureFromFile()
  • IFontObject
    • GetColor()
    • GetFontName()
    • GetFontHeight()
    • GetPositionX()
    • GetPositionY()
    • GetLockPosition()
    • GetText()
    • GetVisibility()
    • GetBold()
    • GetItalic()
    • GetRightJustified()
    • GetAnchor()
    • GetAnchorParent()
    • GetAutoResize()
    • GetParent()
    • SetColor()
    • SetFont()
    • SetPosition()
    • SetLockPosition()
    • SetText()
    • SetVisibility()
    • SetBold()
    • SetItalic()
    • SetRightJustified()
    • SetAnchor()
    • SetAnchorParent()
    • SetAutoResize()
    • SetParent()
    • GetBackground()
  • IChatManager
    • ParseCommand()
    • QueueCommand()
    • AddChatMessage()
    • GetInputText()
    • SetInputText()
    • RunTextScript()
    • Write()
  • IInputManager
    • GetKeyboard()
    • GetMouse()
  • IKeyboard
    • V2D()
    • D2V()
    • S2D()
    • D2S()
  • IMouse
    • Nothing is exposed.
  • IPacketManager
  • IPluginManager
    • GetPluginCount()
  • IPointerManager
    • GetPointer()
  • IResourceManager
    • GetAbilityByID()
    • GetAbilityByName()
    • GetAbilityByTimerID()
    • GetSpellByID()
    • GetSpellByName()
    • GetItemByID()
    • GetItemByName()
    • GetString(string, number)
    • GetString(string, number, number)
    • GetString(string, string)
    • GetString(string, string, number)
  • IDataManager
    • GetEntity()
    • GetInventory()
    • GetParty()
    • GetPlayer()
    • GetTarget()
  • IEntity
    • GetLocalX()
    • GetLocalY()
    • GetLocalZ()
    • GetLocalRoll()
    • GetLocalYaw()
    • GetLocalPitch()
    • GetLastX()
    • GetLastY()
    • GetLastZ()
    • GetLastRoll()
    • GetLastYaw()
    • GetLastPitch()
    • GetMoveX()
    • GetMoveY()
    • GetMoveZ()
    • GetTargetID()
    • GetServerID()
    • GetName()
    • GetMovementSpeed()
    • GetAnimationSpeed()
    • GetWarpPointer()
    • GetDistance()
    • GetHeading()
    • GetPetOwnerID()
    • GetHealthPercent()
    • GetType()
    • GetRace()
    • GetModelFade()
    • GetModelFace()
    • GetModelHead()
    • GetModelBody()
    • GetModelHands()
    • GetModelLegs()
    • GetModelFeet()
    • GetModelMain()
    • GetModelSub()
    • GetModelRanged()
    • GetActionWaitTimer1()
    • GetActionWaitTimer2()
    • GetRenderFlag1()
    • GetRenderFlag2()
    • GetRenderFlag3()
    • GetRenderFlag4()
    • GetRenderFlag5()
    • GetNpcSpeechLoop()
    • GetNpcSpeechFrame()
    • GetMovementSpeed2()
    • GetCostumeID()
    • GetStatus()
    • GetStatusServer()
    • GetStatusNpcChat()
    • GetClaimID()
    • GetAnimationTick()
    • GetAnimationStep()
    • GetAnimationPlay()
    • GetEmoteID()
    • GetSpawnFlags()
    • GetLinkshellColor()
    • GetCampaignNameFlag()
    • GetFishingTimer()
    • GetFishingCastTimer()
    • GetTargetIndex()
    • GetPetIndex()
    • GetModelSize()
    • GetMonstrosityFlag()
    • GetMonstrosityName()
    • SetLocalX()
    • SetLocalY()
    • SetLocalZ()
    • SetLocalRoll()
    • SetLocalYaw()
    • SetLocalPitch()
    • SetLastX()
    • SetLastY()
    • SetLastZ()
    • SetLastRoll()
    • SetLastYaw()
    • SetLastPitch()
    • SetMoveX()
    • SetMoveY()
    • SetMoveZ()
    • SetTargetID()
    • SetServerID()
    • SetName()
    • SetMovementSpeed()
    • SetAnimationSpeed()
    • SetWarpPointer()
    • SetDistance()
    • SetHeading()
    • SetPetOwnerID()
    • SetHealthPercent()
    • SetType()
    • SetRace()
    • SetModelFade()
    • SetModelFace()
    • SetModelHead()
    • SetModelBody()
    • SetModelHands()
    • SetModelLegs()
    • SetModelFeet()
    • SetModelMain()
    • SetModelSub()
    • SetModelRanged()
    • SetActionWaitTimer1()
    • SetActionWaitTimer2()
    • SetRenderFlag1()
    • SetRenderFlag2()
    • SetRenderFlag3()
    • SetRenderFlag4()
    • SetRenderFlag5()
    • SetNpcSpeechLoop()
    • SetNpcSpeechFrame()
    • SetMovementSpeed2()
    • SetCostumeID()
    • SetStatus()
    • SetStatusServer()
    • SetStatusNpcChat()
    • SetClaimID()
    • SetAnimationTick()
    • SetAnimationStep()
    • SetAnimationPlay()
    • SetEmoteID()
    • SetSpawnFlags()
    • SetLinkshellColor()
    • SetCampaignNameFlag()
    • SetFishingTimer()
    • SetFishingCastTimer()
    • SetTargetIndex()
    • SetPetIndex()
    • SetModelSize()
    • SetMonstrosityFlag()
    • SetMonstrosityName()
  • IInventory
    • GetInventoryItem()
    • GetInventoryMax()
    • GetTreasureItem()
    • GetEquipmentItem()
    • GetCraftWaitTimer()
  • IParty
    • GetPartyMemberIndex()
    • GetPartyMemberNumber()
    • GetPartyMemberName()
    • GetPartyMemberID()
    • GetPartyMemberTargetIndex()
    • GetPartyMemberHP()
    • GetPartyMemberMP()
    • GetPartyMemberTP()
    • GetPartyMemberHPP()
    • GetPartyMemberMPP()
    • GetPartyMemberZone()
    • GetPartyMemberActive()
    • GetPartyMemberMainJob()
    • GetPartyMemberMainJobLevel()
    • GetPartyMemberSubJob()
    • GetPartyMemberSubJobLevel()
    • GetAllianceLeaderID()
    • GetAllianceParty0LeaderID()
    • GetAllianceParty1LeaderID()
    • GetAllianceParty2LeaderID()
    • GetAllianceParty0Visible()
    • GetAllianceParty1Visible()
    • GetAllianceParty2Visible()
    • GetAllianceParty0Count()
    • GetAllianceParty1Count()
    • GetAllianceParty2Count()
    • GetAllianceInvitedFlag()
  • IPlayer
    • GetHPMax()
    • GetMPMax()
    • GetMainJob()
    • GetMainJobLevel()
    • GetSubJob()
    • GetSubJobLevel()
    • GetExpCurrent()
    • GetExpNeeded()
    • GetStat()
    • GetStatMod()
    • GetAttack()
    • GetDefense()
    • GetElement()
    • GetTitle()
    • GetRank()
    • GetRankPoints()
    • GetNation()
    • GetResidence()
    • GetHomepoint()
    • GetCombatSkill()
    • GetCraftSkill()
    • GetLimitPoints()
    • GetMeritPoints()
    • GetLimitMode()
    • GetBuffs()
    • HasAbility()
    • HasKeyItem()
    • HasPetCommand()
    • HasSpell()
    • HasTrait()
    • HasWeaponSkill()
    • GetPetTP()
  • ITarget
    • GetTargetName()
    • GetTargetHealthPercent()
    • GetTargetIndex()
    • GetTargetID()
    • GetTargetEntity()
    • GetTargetWarpPtr()
    • GetTargetMask()
    • GetMainTargetIndex()
    • GetMainTargetID()
    • GetMainTargetEntity()
    • GetMainTargetWarpPtr()
    • GetMainTargetMask()
    • GetTargetLockedOn()
    • GetSubTargetActive()
    • GetTargetMenuOpened()
addons/using_ashitacore.txt · Last modified: 2015/12/10 02:36 by atom0s