[Server] Rename variable i into index in script function arguments

Additionally, rename i into index in LangLua.
pull/471/head
David Cernat 7 years ago
parent 65de028e0d
commit 2e0b6e4e3e

@ -162,242 +162,242 @@ public:
/**
* \brief Get the cell description of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The cell description.
*/
static const char *GetActorCell(unsigned int i) noexcept;
static const char *GetActorCell(unsigned int index) noexcept;
/**
* \brief Get the refId of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The refId.
*/
static const char *GetActorRefId(unsigned int i) noexcept;
static const char *GetActorRefId(unsigned int index) noexcept;
/**
* \brief Get the refNum of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The refNum.
*/
static unsigned int GetActorRefNum(unsigned int i) noexcept;
static unsigned int GetActorRefNum(unsigned int index) noexcept;
/**
* \brief Get the mpNum of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The mpNum.
*/
static unsigned int GetActorMpNum(unsigned int i) noexcept;
static unsigned int GetActorMpNum(unsigned int index) noexcept;
/**
* \brief Get the X position of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The X position.
*/
static double GetActorPosX(unsigned int i) noexcept;
static double GetActorPosX(unsigned int index) noexcept;
/**
* \brief Get the Y position of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The Y position.
*/
static double GetActorPosY(unsigned int i) noexcept;
static double GetActorPosY(unsigned int index) noexcept;
/**
* \brief Get the Z position of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The Z position.
*/
static double GetActorPosZ(unsigned int i) noexcept;
static double GetActorPosZ(unsigned int index) noexcept;
/**
* \brief Get the X rotation of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The X rotation.
*/
static double GetActorRotX(unsigned int i) noexcept;
static double GetActorRotX(unsigned int index) noexcept;
/**
* \brief Get the Y rotation of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The Y rotation.
*/
static double GetActorRotY(unsigned int i) noexcept;
static double GetActorRotY(unsigned int index) noexcept;
/**
* \brief Get the Z rotation of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The Z rotation.
*/
static double GetActorRotZ(unsigned int i) noexcept;
static double GetActorRotZ(unsigned int index) noexcept;
/**
* \brief Get the base health of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The base health.
*/
static double GetActorHealthBase(unsigned int i) noexcept;
static double GetActorHealthBase(unsigned int index) noexcept;
/**
* \brief Get the current health of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The current health.
*/
static double GetActorHealthCurrent(unsigned int i) noexcept;
static double GetActorHealthCurrent(unsigned int index) noexcept;
/**
* \brief Get the modified health of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The modified health.
*/
static double GetActorHealthModified(unsigned int i) noexcept;
static double GetActorHealthModified(unsigned int index) noexcept;
/**
* \brief Get the base magicka of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The base magicka.
*/
static double GetActorMagickaBase(unsigned int i) noexcept;
static double GetActorMagickaBase(unsigned int index) noexcept;
/**
* \brief Get the current magicka of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The current magicka.
*/
static double GetActorMagickaCurrent(unsigned int i) noexcept;
static double GetActorMagickaCurrent(unsigned int index) noexcept;
/**
* \brief Get the modified magicka of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The modified magicka.
*/
static double GetActorMagickaModified(unsigned int i) noexcept;
static double GetActorMagickaModified(unsigned int index) noexcept;
/**
* \brief Get the base fatigue of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The base fatigue.
*/
static double GetActorFatigueBase(unsigned int i) noexcept;
static double GetActorFatigueBase(unsigned int index) noexcept;
/**
* \brief Get the current fatigue of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The current fatigue.
*/
static double GetActorFatigueCurrent(unsigned int i) noexcept;
static double GetActorFatigueCurrent(unsigned int index) noexcept;
/**
* \brief Get the modified fatigue of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The modified fatigue.
*/
static double GetActorFatigueModified(unsigned int i) noexcept;
static double GetActorFatigueModified(unsigned int index) noexcept;
/**
* \brief Get the refId of the item in a certain slot of the equipment of the actor at a
* certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \param slot The slot of the equipment item.
* \return The refId.
*/
static const char *GetActorEquipmentItemRefId(unsigned int i, unsigned short slot) noexcept;
static const char *GetActorEquipmentItemRefId(unsigned int index, unsigned short slot) noexcept;
/**
* \brief Get the count of the item in a certain slot of the equipment of the actor at a
* certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \param slot The slot of the equipment item.
* \return The item count.
*/
static int GetActorEquipmentItemCount(unsigned int i, unsigned short slot) noexcept;
static int GetActorEquipmentItemCount(unsigned int index, unsigned short slot) noexcept;
/**
* \brief Get the charge of the item in a certain slot of the equipment of the actor at a
* certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \param slot The slot of the equipment item.
* \return The charge.
*/
static int GetActorEquipmentItemCharge(unsigned int i, unsigned short slot) noexcept;
static int GetActorEquipmentItemCharge(unsigned int index, unsigned short slot) noexcept;
/**
* \brief Get the enchantment charge of the item in a certain slot of the equipment of the actor at a
* certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \param slot The slot of the equipment item.
* \return The enchantment charge.
*/
static double GetActorEquipmentItemEnchantmentCharge(unsigned int i, unsigned short slot) noexcept;
static double GetActorEquipmentItemEnchantmentCharge(unsigned int index, unsigned short slot) noexcept;
/**
* \brief Check whether the killer of the actor at a certain index in the read actor list is a player.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return Whether the actor was killed by a player.
*/
static bool DoesActorHavePlayerKiller(unsigned int i) noexcept;
static bool DoesActorHavePlayerKiller(unsigned int index) noexcept;
/**
* \brief Get the player ID of the killer of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The player ID of the killer.
*/
static int GetActorKillerPid(unsigned int i) noexcept;
static int GetActorKillerPid(unsigned int index) noexcept;
/**
* \brief Get the refId of the actor killer of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The refId of the killer.
*/
static const char *GetActorKillerRefId(unsigned int i) noexcept;
static const char *GetActorKillerRefId(unsigned int index) noexcept;
/**
* \brief Get the refNum of the actor killer of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The refNum of the killer.
*/
static unsigned int GetActorKillerRefNum(unsigned int i) noexcept;
static unsigned int GetActorKillerRefNum(unsigned int index) noexcept;
/**
* \brief Get the mpNum of the actor killer of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The mpNum of the killer.
*/
static unsigned int GetActorKillerMpNum(unsigned int i) noexcept;
static unsigned int GetActorKillerMpNum(unsigned int index) noexcept;
/**
* \brief Get the name of the actor killer of the actor at a certain index in the read actor list.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return The name of the killer.
*/
static const char *GetActorKillerName(unsigned int i) noexcept;
static const char *GetActorKillerName(unsigned int index) noexcept;
/**
* \brief Check whether there is any positional data for the actor at a certain index in
@ -405,10 +405,10 @@ public:
*
* This is only useful when reading the actor list data recorded for a particular cell.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return Whether the read actor list contains positional data.
*/
static bool DoesActorHavePosition(unsigned int i) noexcept;
static bool DoesActorHavePosition(unsigned int index) noexcept;
/**
* \brief Check whether there is any dynamic stats data for the actor at a certain index in
@ -416,10 +416,10 @@ public:
*
* This is only useful when reading the actor list data recorded for a particular cell.
*
* \param i The index of the actor.
* \param index The index of the actor.
* \return Whether the read actor list contains dynamic stats data.
*/
static bool DoesActorHaveStatsDynamic(unsigned int i) noexcept;
static bool DoesActorHaveStatsDynamic(unsigned int index) noexcept;
/**
* \brief Set the cell of the temporary actor list stored on the server.
@ -749,8 +749,8 @@ public:
static void ReadLastActorList() noexcept;
static void InitializeActorList(unsigned short pid) noexcept;
static void CopyLastActorListToStore() noexcept;
static unsigned int GetActorRefNumIndex(unsigned int i) noexcept;
static unsigned int GetActorKillerRefNumIndex(unsigned int i) noexcept;
static unsigned int GetActorRefNumIndex(unsigned int index) noexcept;
static unsigned int GetActorKillerRefNumIndex(unsigned int index) noexcept;
static void SetActorRefNumIndex(int refNum) noexcept;
};

@ -34,15 +34,15 @@ void BookFunctions::AddBook(unsigned short pid, const char* bookId) noexcept
player->bookChanges.books.push_back(book);
}
const char *BookFunctions::GetBookId(unsigned short pid, unsigned int i) noexcept
const char *BookFunctions::GetBookId(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, "");
if (i >= player->bookChanges.count)
if (index >= player->bookChanges.count)
return "invalid";
return player->bookChanges.books.at(i).bookId.c_str();
return player->bookChanges.books.at(index).bookId.c_str();
}
void BookFunctions::SendBookChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept

@ -47,10 +47,10 @@ public:
* \brief Get the bookId at a certain index in a player's latest book changes.
*
* \param pid The player ID whose book changes should be used.
* \param i The index of the book.
* \param index The index of the book.
* \return The bookId.
*/
static const char *GetBookId(unsigned short pid, unsigned int i) noexcept;
static const char *GetBookId(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Send a PlayerBook packet with a player's recorded book changes.

@ -20,23 +20,23 @@ unsigned int CellFunctions::GetCellStateChangesSize(unsigned short pid) noexcept
return player->cellStateChanges.count;
}
unsigned int CellFunctions::GetCellStateType(unsigned short pid, unsigned int i) noexcept
unsigned int CellFunctions::GetCellStateType(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->cellStateChanges.cellStates.at(i).type;
return player->cellStateChanges.cellStates.at(index).type;
}
const char *CellFunctions::GetCellStateDescription(unsigned short pid, unsigned int i) noexcept
const char *CellFunctions::GetCellStateDescription(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, "");
if (i >= player->cellStateChanges.count)
if (index >= player->cellStateChanges.count)
return "invalid";
tempCellDescription = player->cellStateChanges.cellStates.at(i).cell.getDescription();
tempCellDescription = player->cellStateChanges.cellStates.at(index).cell.getDescription();
return tempCellDescription.c_str();
}

@ -39,19 +39,19 @@ public:
* \brief Get the cell state type at a certain index in a player's latest cell state changes.
*
* \param pid The player ID whose cell state changes should be used.
* \param i The index of the cell state.
* \param index The index of the cell state.
* \return The cell state type (0 for LOAD, 1 for UNLOAD).
*/
static unsigned int GetCellStateType(unsigned short pid, unsigned int i) noexcept;
static unsigned int GetCellStateType(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the cell description at a certain index in a player's latest cell state changes.
*
* \param pid The player ID whose cell state changes should be used.
* \param i The index of the cell state.
* \param index The index of the cell state.
* \return The cell description.
*/
static const char *GetCellStateDescription(unsigned short pid, unsigned int i) noexcept;
static const char *GetCellStateDescription(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the cell description of a player's cell.

@ -34,15 +34,15 @@ void DialogueFunctions::AddTopic(unsigned short pid, const char* topicId) noexce
player->topicChanges.topics.push_back(topic);
}
const char *DialogueFunctions::GetTopicId(unsigned short pid, unsigned int i) noexcept
const char *DialogueFunctions::GetTopicId(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, "");
if (i >= player->topicChanges.count)
if (index >= player->topicChanges.count)
return "invalid";
return player->topicChanges.topics.at(i).topicId.c_str();
return player->topicChanges.topics.at(index).topicId.c_str();
}
void DialogueFunctions::SendTopicChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept

@ -50,10 +50,10 @@ public:
* \brief Get the topicId at a certain index in a player's latest topic changes.
*
* \param pid The player ID whose topic changes should be used.
* \param i The index of the topic.
* \param index The index of the topic.
* \return The topicId.
*/
static const char *GetTopicId(unsigned short pid, unsigned int i) noexcept;
static const char *GetTopicId(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Send a PlayerTopic packet with a player's recorded topic changes.

@ -35,39 +35,39 @@ unsigned char FactionFunctions::GetFactionChangesAction(unsigned short pid) noex
return player->factionChanges.action;
}
const char *FactionFunctions::GetFactionId(unsigned short pid, unsigned int i) noexcept
const char *FactionFunctions::GetFactionId(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, "");
if (i >= player->factionChanges.count)
if (index >= player->factionChanges.count)
return "invalid";
return player->factionChanges.factions.at(i).factionId.c_str();
return player->factionChanges.factions.at(index).factionId.c_str();
}
int FactionFunctions::GetFactionRank(unsigned short pid, unsigned int i) noexcept
int FactionFunctions::GetFactionRank(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->factionChanges.factions.at(i).rank;
return player->factionChanges.factions.at(index).rank;
}
bool FactionFunctions::GetFactionExpulsionState(unsigned short pid, unsigned int i) noexcept
bool FactionFunctions::GetFactionExpulsionState(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, false);
return player->factionChanges.factions.at(i).isExpelled;
return player->factionChanges.factions.at(index).isExpelled;
}
int FactionFunctions::GetFactionReputation(unsigned short pid, unsigned int i) noexcept
int FactionFunctions::GetFactionReputation(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->factionChanges.factions.at(i).reputation;
return player->factionChanges.factions.at(index).reputation;
}
void FactionFunctions::SetFactionChangesAction(unsigned short pid, unsigned char action) noexcept

@ -56,37 +56,37 @@ public:
* \brief Get the factionId at a certain index in a player's latest faction changes.
*
* \param pid The player ID whose faction changes should be used.
* \param i The index of the faction.
* \param index The index of the faction.
* \return The factionId.
*/
static const char *GetFactionId(unsigned short pid, unsigned int i) noexcept;
static const char *GetFactionId(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the rank at a certain index in a player's latest faction changes.
*
* \param pid The player ID whose faction changes should be used.
* \param i The index of the faction.
* \param index The index of the faction.
* \return The rank.
*/
static int GetFactionRank(unsigned short pid, unsigned int i) noexcept;
static int GetFactionRank(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the expulsion state at a certain index in a player's latest faction changes.
*
* \param pid The player ID whose faction changes should be used.
* \param i The index of the faction.
* \param index The index of the faction.
* \return The expulsion state.
*/
static bool GetFactionExpulsionState(unsigned short pid, unsigned int i) noexcept;
static bool GetFactionExpulsionState(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the reputation at a certain index in a player's latest faction changes.
*
* \param pid The player ID whose faction changes should be used.
* \param i The index of the faction.
* \param index The index of the faction.
* \return The reputation.
*/
static int GetFactionReputation(unsigned short pid, unsigned int i) noexcept;
static int GetFactionReputation(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Set the action type in a player's faction changes.

@ -104,37 +104,37 @@ unsigned int GUIFunctions::GetQuickKeyChangesSize(unsigned short pid) noexcept
return player->quickKeyChanges.count;
}
int GUIFunctions::GetQuickKeySlot(unsigned short pid, unsigned int i) noexcept
int GUIFunctions::GetQuickKeySlot(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->quickKeyChanges.count)
if (index >= player->quickKeyChanges.count)
return 0;
return player->quickKeyChanges.quickKeys.at(i).slot;
return player->quickKeyChanges.quickKeys.at(index).slot;
}
int GUIFunctions::GetQuickKeyType(unsigned short pid, unsigned int i) noexcept
int GUIFunctions::GetQuickKeyType(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->quickKeyChanges.count)
if (index >= player->quickKeyChanges.count)
return 0;
return player->quickKeyChanges.quickKeys.at(i).type;
return player->quickKeyChanges.quickKeys.at(index).type;
}
const char *GUIFunctions::GetQuickKeyItemId(unsigned short pid, unsigned int i) noexcept
const char *GUIFunctions::GetQuickKeyItemId(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, "");
if (i >= player->quickKeyChanges.count)
if (index >= player->quickKeyChanges.count)
return "invalid";
return player->quickKeyChanges.quickKeys.at(i).itemId.c_str();
return player->quickKeyChanges.quickKeys.at(index).itemId.c_str();
}
void GUIFunctions::AddQuickKey(unsigned short pid, unsigned short slot, int type, const char* itemId) noexcept

@ -128,28 +128,28 @@ public:
* \brief Get the slot of the quick key at a certain index in a player's latest quick key changes.
*
* \param pid The player ID whose quick key changes should be used.
* \param i The index of the quick key in the quick key changes vector.
* \param index The index of the quick key in the quick key changes vector.
* \return The slot.
*/
static int GetQuickKeySlot(unsigned short pid, unsigned int i) noexcept;
static int GetQuickKeySlot(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the type of the quick key at a certain index in a player's latest quick key changes.
*
* \param pid The player ID whose quick key changes should be used.
* \param i The index of the quick key in the quick key changes vector.
* \param index The index of the quick key in the quick key changes vector.
* \return The quick key type.
*/
static int GetQuickKeyType(unsigned short pid, unsigned int i) noexcept;
static int GetQuickKeyType(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the itemId at a certain index in a player's latest quick key changes.
*
* \param pid The player ID whose quick key changes should be used.
* \param i The index of the quick key in the quick key changes vector.
* \param index The index of the quick key in the quick key changes vector.
* \return The itemId.
*/
static const char *GetQuickKeyItemId(unsigned short pid, unsigned int i) noexcept;
static const char *GetQuickKeyItemId(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Send a PlayerQuickKeys packet with a player's recorded quick key changes.

@ -124,39 +124,39 @@ double ItemFunctions::GetEquipmentItemEnchantmentCharge(unsigned short pid, unsi
return player->equipmentItems[slot].enchantmentCharge;
}
const char *ItemFunctions::GetInventoryItemRefId(unsigned short pid, unsigned int i) noexcept
const char *ItemFunctions::GetInventoryItemRefId(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, "");
if (i >= player->inventoryChanges.count)
if (index >= player->inventoryChanges.count)
return "invalid";
return player->inventoryChanges.items.at(i).refId.c_str();
return player->inventoryChanges.items.at(index).refId.c_str();
}
int ItemFunctions::GetInventoryItemCount(unsigned short pid, unsigned int i) noexcept
int ItemFunctions::GetInventoryItemCount(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->inventoryChanges.items.at(i).count;
return player->inventoryChanges.items.at(index).count;
}
int ItemFunctions::GetInventoryItemCharge(unsigned short pid, unsigned int i) noexcept
int ItemFunctions::GetInventoryItemCharge(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->inventoryChanges.items.at(i).charge;
return player->inventoryChanges.items.at(index).charge;
}
double ItemFunctions::GetInventoryItemEnchantmentCharge(unsigned short pid, unsigned int i) noexcept
double ItemFunctions::GetInventoryItemEnchantmentCharge(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->inventoryChanges.items.at(i).enchantmentCharge;
return player->inventoryChanges.items.at(index).enchantmentCharge;
}
void ItemFunctions::SendEquipment(unsigned short pid) noexcept

@ -162,40 +162,40 @@ public:
* changes.
*
* \param pid The player ID whose inventory changes should be used.
* \param i The index of the inventory item.
* \param index The index of the inventory item.
* \return The refId.
*/
static const char *GetInventoryItemRefId(unsigned short pid, unsigned int i) noexcept;
static const char *GetInventoryItemRefId(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the count of the item at a certain index in a player's latest inventory
* changes.
*
* \param pid The player ID whose inventory changes should be used.
* \param i The index of the inventory item.
* \param index The index of the inventory item.
* \return The item count.
*/
static int GetInventoryItemCount(unsigned short pid, unsigned int i) noexcept;
static int GetInventoryItemCount(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the charge of the item at a certain index in a player's latest inventory
* changes.
*
* \param pid The player ID whose inventory changes should be used.
* \param i The index of the inventory item.
* \param index The index of the inventory item.
* \return The charge.
*/
static int GetInventoryItemCharge(unsigned short pid, unsigned int i) noexcept;
static int GetInventoryItemCharge(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the enchantment charge of the item at a certain index in a player's
* latest inventory changes.
*
* \param pid The player ID whose inventory changes should be used.
* \param i The index of the inventory item.
* \param index The index of the inventory item.
* \return The enchantment charge.
*/
static double GetInventoryItemEnchantmentCharge(unsigned short pid, unsigned int i) noexcept;
static double GetInventoryItemEnchantmentCharge(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Send a PlayerEquipment packet with a player's equipment.

@ -69,14 +69,14 @@ unsigned char ObjectFunctions::GetObjectListContainerSubAction() noexcept
return readObjectList->containerSubAction;
}
bool ObjectFunctions::IsObjectPlayer(unsigned int i) noexcept
bool ObjectFunctions::IsObjectPlayer(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).isPlayer;
return readObjectList->baseObjects.at(index).isPlayer;
}
int ObjectFunctions::GetObjectPid(unsigned int i) noexcept
int ObjectFunctions::GetObjectPid(unsigned int index) noexcept
{
Player *player = Players::getPlayer(readObjectList->baseObjects.at(i).guid);
Player *player = Players::getPlayer(readObjectList->baseObjects.at(index).guid);
if (player != nullptr)
return player->getId();
@ -84,69 +84,69 @@ int ObjectFunctions::GetObjectPid(unsigned int i) noexcept
return -1;
}
const char *ObjectFunctions::GetObjectRefId(unsigned int i) noexcept
const char *ObjectFunctions::GetObjectRefId(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).refId.c_str();
return readObjectList->baseObjects.at(index).refId.c_str();
}
unsigned int ObjectFunctions::GetObjectRefNum(unsigned int i) noexcept
unsigned int ObjectFunctions::GetObjectRefNum(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).refNum;
return readObjectList->baseObjects.at(index).refNum;
}
unsigned int ObjectFunctions::GetObjectMpNum(unsigned int i) noexcept
unsigned int ObjectFunctions::GetObjectMpNum(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).mpNum;
return readObjectList->baseObjects.at(index).mpNum;
}
int ObjectFunctions::GetObjectCount(unsigned int i) noexcept
int ObjectFunctions::GetObjectCount(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).count;
return readObjectList->baseObjects.at(index).count;
}
int ObjectFunctions::GetObjectCharge(unsigned int i) noexcept
int ObjectFunctions::GetObjectCharge(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).charge;
return readObjectList->baseObjects.at(index).charge;
}
double ObjectFunctions::GetObjectEnchantmentCharge(unsigned int i) noexcept
double ObjectFunctions::GetObjectEnchantmentCharge(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).enchantmentCharge;
return readObjectList->baseObjects.at(index).enchantmentCharge;
}
int ObjectFunctions::GetObjectGoldValue(unsigned int i) noexcept
int ObjectFunctions::GetObjectGoldValue(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).goldValue;
return readObjectList->baseObjects.at(index).goldValue;
}
double ObjectFunctions::GetObjectScale(unsigned int i) noexcept
double ObjectFunctions::GetObjectScale(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).scale;
return readObjectList->baseObjects.at(index).scale;
}
bool ObjectFunctions::GetObjectState(unsigned int i) noexcept
bool ObjectFunctions::GetObjectState(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).objectState;
return readObjectList->baseObjects.at(index).objectState;
}
int ObjectFunctions::GetObjectDoorState(unsigned int i) noexcept
int ObjectFunctions::GetObjectDoorState(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).doorState;
return readObjectList->baseObjects.at(index).doorState;
}
int ObjectFunctions::GetObjectLockLevel(unsigned int i) noexcept
int ObjectFunctions::GetObjectLockLevel(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).lockLevel;
return readObjectList->baseObjects.at(index).lockLevel;
}
bool ObjectFunctions::DoesObjectHavePlayerActivating(unsigned int i) noexcept
bool ObjectFunctions::DoesObjectHavePlayerActivating(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).activatingActor.isPlayer;
return readObjectList->baseObjects.at(index).activatingActor.isPlayer;
}
int ObjectFunctions::GetObjectActivatingPid(unsigned int i) noexcept
int ObjectFunctions::GetObjectActivatingPid(unsigned int index) noexcept
{
Player *player = Players::getPlayer(readObjectList->baseObjects.at(i).activatingActor.guid);
Player *player = Players::getPlayer(readObjectList->baseObjects.at(index).activatingActor.guid);
if (player != nullptr)
return player->getId();
@ -154,44 +154,44 @@ int ObjectFunctions::GetObjectActivatingPid(unsigned int i) noexcept
return -1;
}
const char *ObjectFunctions::GetObjectActivatingRefId(unsigned int i) noexcept
const char *ObjectFunctions::GetObjectActivatingRefId(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).activatingActor.refId.c_str();
return readObjectList->baseObjects.at(index).activatingActor.refId.c_str();
}
unsigned int ObjectFunctions::GetObjectActivatingRefNum(unsigned int i) noexcept
unsigned int ObjectFunctions::GetObjectActivatingRefNum(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).activatingActor.refNum;
return readObjectList->baseObjects.at(index).activatingActor.refNum;
}
unsigned int ObjectFunctions::GetObjectActivatingMpNum(unsigned int i) noexcept
unsigned int ObjectFunctions::GetObjectActivatingMpNum(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).activatingActor.mpNum;
return readObjectList->baseObjects.at(index).activatingActor.mpNum;
}
const char *ObjectFunctions::GetObjectActivatingName(unsigned int i) noexcept
const char *ObjectFunctions::GetObjectActivatingName(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).activatingActor.name.c_str();
return readObjectList->baseObjects.at(index).activatingActor.name.c_str();
}
bool ObjectFunctions::GetObjectSummonState(unsigned int i) noexcept
bool ObjectFunctions::GetObjectSummonState(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).isSummon;
return readObjectList->baseObjects.at(index).isSummon;
}
double ObjectFunctions::GetObjectSummonDuration(unsigned int i) noexcept
double ObjectFunctions::GetObjectSummonDuration(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).summonDuration;
return readObjectList->baseObjects.at(index).summonDuration;
}
bool ObjectFunctions::DoesObjectHavePlayerSummoner(unsigned int i) noexcept
bool ObjectFunctions::DoesObjectHavePlayerSummoner(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).master.isPlayer;
return readObjectList->baseObjects.at(index).master.isPlayer;
}
int ObjectFunctions::GetObjectSummonerPid(unsigned int i) noexcept
int ObjectFunctions::GetObjectSummonerPid(unsigned int index) noexcept
{
Player *player = Players::getPlayer(readObjectList->baseObjects.at(i).master.guid);
Player *player = Players::getPlayer(readObjectList->baseObjects.at(index).master.guid);
if (player != nullptr)
return player->getId();
@ -199,54 +199,54 @@ int ObjectFunctions::GetObjectSummonerPid(unsigned int i) noexcept
return -1;
}
const char *ObjectFunctions::GetObjectSummonerRefId(unsigned int i) noexcept
const char *ObjectFunctions::GetObjectSummonerRefId(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).master.refId.c_str();
return readObjectList->baseObjects.at(index).master.refId.c_str();
}
unsigned int ObjectFunctions::GetObjectSummonerRefNum(unsigned int i) noexcept
unsigned int ObjectFunctions::GetObjectSummonerRefNum(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).master.refNum;
return readObjectList->baseObjects.at(index).master.refNum;
}
unsigned int ObjectFunctions::GetObjectSummonerMpNum(unsigned int i) noexcept
unsigned int ObjectFunctions::GetObjectSummonerMpNum(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).master.mpNum;
return readObjectList->baseObjects.at(index).master.mpNum;
}
double ObjectFunctions::GetObjectPosX(unsigned int i) noexcept
double ObjectFunctions::GetObjectPosX(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).position.pos[0];
return readObjectList->baseObjects.at(index).position.pos[0];
}
double ObjectFunctions::GetObjectPosY(unsigned int i) noexcept
double ObjectFunctions::GetObjectPosY(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).position.pos[1];
return readObjectList->baseObjects.at(index).position.pos[1];
}
double ObjectFunctions::GetObjectPosZ(unsigned int i) noexcept
double ObjectFunctions::GetObjectPosZ(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).position.pos[2];
return readObjectList->baseObjects.at(index).position.pos[2];
}
double ObjectFunctions::GetObjectRotX(unsigned int i) noexcept
double ObjectFunctions::GetObjectRotX(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).position.rot[0];
return readObjectList->baseObjects.at(index).position.rot[0];
}
double ObjectFunctions::GetObjectRotY(unsigned int i) noexcept
double ObjectFunctions::GetObjectRotY(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).position.rot[1];
return readObjectList->baseObjects.at(index).position.rot[1];
}
double ObjectFunctions::GetObjectRotZ(unsigned int i) noexcept
double ObjectFunctions::GetObjectRotZ(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).position.rot[2];
return readObjectList->baseObjects.at(index).position.rot[2];
}
const char *ObjectFunctions::GetVideoFilename(unsigned int i) noexcept
const char *ObjectFunctions::GetVideoFilename(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).videoFilename.c_str();
return readObjectList->baseObjects.at(index).videoFilename.c_str();
}
unsigned int ObjectFunctions::GetContainerChangesSize(unsigned int objectIndex) noexcept
@ -284,9 +284,9 @@ int ObjectFunctions::GetContainerItemActionCount(unsigned int objectIndex, unsig
.containerItems.at(itemIndex).actionCount;
}
bool ObjectFunctions::DoesObjectHaveContainer(unsigned int i) noexcept
bool ObjectFunctions::DoesObjectHaveContainer(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(i).hasContainer;
return readObjectList->baseObjects.at(index).hasContainer;
}
void ObjectFunctions::SetObjectListCell(const char* cellDescription) noexcept
@ -647,14 +647,14 @@ unsigned char ObjectFunctions::GetEventContainerSubAction() noexcept
return GetObjectListContainerSubAction();
}
unsigned int ObjectFunctions::GetObjectRefNumIndex(unsigned int i) noexcept
unsigned int ObjectFunctions::GetObjectRefNumIndex(unsigned int index) noexcept
{
return GetObjectRefNum(i);
return GetObjectRefNum(index);
}
unsigned int ObjectFunctions::GetObjectSummonerRefNumIndex(unsigned int i) noexcept
unsigned int ObjectFunctions::GetObjectSummonerRefNumIndex(unsigned int index) noexcept
{
return GetObjectSummonerRefNum(i);
return GetObjectSummonerRefNum(index);
}
void ObjectFunctions::SetEventCell(const char* cellDescription) noexcept

@ -212,10 +212,10 @@ public:
* object activation is general enough for players themselves to be included
* as objects in ObjectActivate packets.
*
* \param i The index of the object.
* \param index The index of the object.
* \return Whether the object is a player.
*/
static bool IsObjectPlayer(unsigned int i) noexcept;
static bool IsObjectPlayer(unsigned int index) noexcept;
/**
* \brief Get the player ID of the object at a certain index in the read object list,
@ -224,154 +224,154 @@ public:
* Note: Currently, players can only be objects in ObjectActivate and ConsoleCommand
* packets.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The player ID of the object.
*/
static int GetObjectPid(unsigned int i) noexcept;
static int GetObjectPid(unsigned int index) noexcept;
/**
* \brief Get the refId of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The refId.
*/
static const char *GetObjectRefId(unsigned int i) noexcept;
static const char *GetObjectRefId(unsigned int index) noexcept;
/**
* \brief Get the refNum of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The refNum.
*/
static unsigned int GetObjectRefNum(unsigned int i) noexcept;
static unsigned int GetObjectRefNum(unsigned int index) noexcept;
/**
* \brief Get the mpNum of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The mpNum.
*/
static unsigned int GetObjectMpNum(unsigned int i) noexcept;
static unsigned int GetObjectMpNum(unsigned int index) noexcept;
/**
* \brief Get the count of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The object count.
*/
static int GetObjectCount(unsigned int i) noexcept;
static int GetObjectCount(unsigned int index) noexcept;
/**
* \brief Get the charge of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The charge.
*/
static int GetObjectCharge(unsigned int i) noexcept;
static int GetObjectCharge(unsigned int index) noexcept;
/**
* \brief Get the enchantment charge of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The enchantment charge.
*/
static double GetObjectEnchantmentCharge(unsigned int i) noexcept;
static double GetObjectEnchantmentCharge(unsigned int index) noexcept;
/**
* \brief Get the gold value of the object at a certain index in the read object list.
*
* This is used solely to get the gold value of gold. It is not used for other objects.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The gold value.
*/
static int GetObjectGoldValue(unsigned int i) noexcept;
static int GetObjectGoldValue(unsigned int index) noexcept;
/**
* \brief Get the object scale of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The object scale.
*/
static double GetObjectScale(unsigned int i) noexcept;
static double GetObjectScale(unsigned int index) noexcept;
/**
* \brief Get the object state of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The object state.
*/
static bool GetObjectState(unsigned int i) noexcept;
static bool GetObjectState(unsigned int index) noexcept;
/**
* \brief Get the door state of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The door state.
*/
static int GetObjectDoorState(unsigned int i) noexcept;
static int GetObjectDoorState(unsigned int index) noexcept;
/**
* \brief Get the lock level of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The lock level.
*/
static int GetObjectLockLevel(unsigned int i) noexcept;
static int GetObjectLockLevel(unsigned int index) noexcept;
/**
* \brief Check whether the object at a certain index in the read object list has been
* activated by a player.
*
* \param i The index of the object.
* \param index The index of the object.
* \return Whether the object has been activated by a player.
*/
static bool DoesObjectHavePlayerActivating(unsigned int i) noexcept;
static bool DoesObjectHavePlayerActivating(unsigned int index) noexcept;
/**
* \brief Get the player ID of the player activating the object at a certain index in the
* read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The player ID of the activating player.
*/
static int GetObjectActivatingPid(unsigned int i) noexcept;
static int GetObjectActivatingPid(unsigned int index) noexcept;
/**
* \brief Get the refId of the actor activating the object at a certain index in the read
* object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The refId of the activating actor.
*/
static const char *GetObjectActivatingRefId(unsigned int i) noexcept;
static const char *GetObjectActivatingRefId(unsigned int index) noexcept;
/**
* \brief Get the refNum of the actor activating the object at a certain index in the read
* object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The refNum of the activating actor.
*/
static unsigned int GetObjectActivatingRefNum(unsigned int i) noexcept;
static unsigned int GetObjectActivatingRefNum(unsigned int index) noexcept;
/**
* \brief Get the mpNum of the actor activating the object at a certain index in the read
* object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The mpNum of the activating actor.
*/
static unsigned int GetObjectActivatingMpNum(unsigned int i) noexcept;
static unsigned int GetObjectActivatingMpNum(unsigned int index) noexcept;
/**
* \brief Get the name of the actor activating the object at a certain index in the read
* object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The name of the activating actor.
*/
static const char *GetObjectActivatingName(unsigned int i) noexcept;
static const char *GetObjectActivatingName(unsigned int index) noexcept;
/**
* \brief Check whether the object at a certain index in the read object list is a
@ -381,17 +381,17 @@ public:
*
* \return The summon state.
*/
static bool GetObjectSummonState(unsigned int i) noexcept;
static bool GetObjectSummonState(unsigned int index) noexcept;
/**
* \brief Get the summon duration of the object at a certain index in the read object list.
*
* Note: Returns -1 if indefinite.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The summon duration.
*/
static double GetObjectSummonDuration(unsigned int i) noexcept;
static double GetObjectSummonDuration(unsigned int index) noexcept;
/**
* \brief Check whether the object at a certain index in the read object list has a player
@ -399,106 +399,106 @@ public:
*
* Only living actors can be summoned.
*
* \param i The index of the object.
* \param index The index of the object.
* \return Whether a player is the summoner of the object.
*/
static bool DoesObjectHavePlayerSummoner(unsigned int i) noexcept;
static bool DoesObjectHavePlayerSummoner(unsigned int index) noexcept;
/**
* \brief Get the player ID of the summoner of the object at a certain index in the read object
* list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The player ID of the summoner.
*/
static int GetObjectSummonerPid(unsigned int i) noexcept;
static int GetObjectSummonerPid(unsigned int index) noexcept;
/**
* \brief Get the refId of the actor summoner of the object at a certain index in the read object
* list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The refId of the summoner.
*/
static const char *GetObjectSummonerRefId(unsigned int i) noexcept;
static const char *GetObjectSummonerRefId(unsigned int index) noexcept;
/**
* \brief Get the refNum of the actor summoner of the object at a certain index in the read object
* list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The refNum of the summoner.
*/
static unsigned int GetObjectSummonerRefNum(unsigned int i) noexcept;
static unsigned int GetObjectSummonerRefNum(unsigned int index) noexcept;
/**
* \brief Get the mpNum of the actor summoner of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The mpNum of the summoner.
*/
static unsigned int GetObjectSummonerMpNum(unsigned int i) noexcept;
static unsigned int GetObjectSummonerMpNum(unsigned int index) noexcept;
/**
* \brief Get the X position of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The X position.
*/
static double GetObjectPosX(unsigned int i) noexcept;
static double GetObjectPosX(unsigned int index) noexcept;
/**
* \brief Get the Y position of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The Y position.
*/
static double GetObjectPosY(unsigned int i) noexcept;
static double GetObjectPosY(unsigned int index) noexcept;
/**
* \brief Get the Z position at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The Z position.
*/
static double GetObjectPosZ(unsigned int i) noexcept;
static double GetObjectPosZ(unsigned int index) noexcept;
/**
* \brief Get the X rotation of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The X rotation.
*/
static double GetObjectRotX(unsigned int i) noexcept;
static double GetObjectRotX(unsigned int index) noexcept;
/**
* \brief Get the Y rotation of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The Y rotation.
*/
static double GetObjectRotY(unsigned int i) noexcept;
static double GetObjectRotY(unsigned int index) noexcept;
/**
* \brief Get the Z rotation of the object at a certain index in the read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The Z rotation.
*/
static double GetObjectRotZ(unsigned int i) noexcept;
static double GetObjectRotZ(unsigned int index) noexcept;
/**
* \brief Get the videoFilename of the object at a certain index in the read object list.
*
* \return The videoFilename.
*/
static const char *GetVideoFilename(unsigned int i) noexcept;
static const char *GetVideoFilename(unsigned int index) noexcept;
/**
* \brief Get the number of container item indexes of the object at a certain index in the
* read object list.
*
* \param i The index of the object.
* \param index The index of the object.
* \return The number of container item indexes.
*/
static unsigned int GetContainerChangesSize(unsigned int objectIndex) noexcept;
@ -559,10 +559,10 @@ public:
* Note: Only ObjectLists from ObjectPlace packets contain this information. Objects from
* received ObjectSpawn packets can always be assumed to have a container.
*
* \param i The index of the object.
* \param index The index of the object.
* \return Whether the object has a container.
*/
static bool DoesObjectHaveContainer(unsigned int i) noexcept;
static bool DoesObjectHaveContainer(unsigned int index) noexcept;
/**
* \brief Set the cell of the temporary object list stored on the server.
@ -1029,8 +1029,8 @@ public:
static unsigned int GetObjectChangesSize() noexcept;
static unsigned char GetEventAction() noexcept;
static unsigned char GetEventContainerSubAction() noexcept;
static unsigned int GetObjectRefNumIndex(unsigned int i) noexcept;
static unsigned int GetObjectSummonerRefNumIndex(unsigned int i) noexcept;
static unsigned int GetObjectRefNumIndex(unsigned int index) noexcept;
static unsigned int GetObjectSummonerRefNumIndex(unsigned int index) noexcept;
static void SetEventCell(const char* cellDescription) noexcept;
static void SetEventAction(unsigned char action) noexcept;
static void SetEventConsoleCommand(const char* consoleCommand) noexcept;

@ -87,58 +87,58 @@ void QuestFunctions::SetReputation(unsigned short pid, int value) noexcept
player->npcStats.mReputation = value;
}
const char *QuestFunctions::GetJournalItemQuest(unsigned short pid, unsigned int i) noexcept
const char *QuestFunctions::GetJournalItemQuest(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, "");
if (i >= player->journalChanges.count)
if (index >= player->journalChanges.count)
return "invalid";
return player->journalChanges.journalItems.at(i).quest.c_str();
return player->journalChanges.journalItems.at(index).quest.c_str();
}
int QuestFunctions::GetJournalItemIndex(unsigned short pid, unsigned int i) noexcept
int QuestFunctions::GetJournalItemIndex(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->journalChanges.journalItems.at(i).index;
return player->journalChanges.journalItems.at(index).index;
}
int QuestFunctions::GetJournalItemType(unsigned short pid, unsigned int i) noexcept
int QuestFunctions::GetJournalItemType(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->journalChanges.journalItems.at(i).type;
return player->journalChanges.journalItems.at(index).type;
}
const char *QuestFunctions::GetJournalItemActorRefId(unsigned short pid, unsigned int i) noexcept
const char *QuestFunctions::GetJournalItemActorRefId(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->journalChanges.journalItems.at(i).actorRefId.c_str();
return player->journalChanges.journalItems.at(index).actorRefId.c_str();
}
const char *QuestFunctions::GetKillRefId(unsigned short pid, unsigned int i) noexcept
const char *QuestFunctions::GetKillRefId(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, "");
if (i >= player->killChanges.count)
if (index >= player->killChanges.count)
return "invalid";
return player->killChanges.kills.at(i).refId.c_str();
return player->killChanges.kills.at(index).refId.c_str();
}
int QuestFunctions::GetKillNumber(unsigned short pid, unsigned int i) noexcept
int QuestFunctions::GetKillNumber(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->killChanges.kills.at(i).number;
return player->killChanges.kills.at(index).number;
}
int QuestFunctions::GetReputation(unsigned short pid) noexcept

@ -111,28 +111,28 @@ public:
* \brief Get the quest at a certain index in a player's latest journal changes.
*
* \param pid The player ID whose journal changes should be used.
* \param i The index of the journalItem.
* \param index The index of the journalItem.
* \return The quest.
*/
static const char *GetJournalItemQuest(unsigned short pid, unsigned int i) noexcept;
static const char *GetJournalItemQuest(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the quest index at a certain index in a player's latest journal changes.
*
* \param pid The player ID whose journal changes should be used.
* \param i The index of the journalItem.
* \param index The index of the journalItem.
* \return The quest index.
*/
static int GetJournalItemIndex(unsigned short pid, unsigned int i) noexcept;
static int GetJournalItemIndex(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the journal item type at a certain index in a player's latest journal changes.
*
* \param pid The player ID whose journal changes should be used.
* \param i The index of the journalItem.
* \param index The index of the journalItem.
* \return The type (0 for ENTRY, 1 for INDEX).
*/
static int GetJournalItemType(unsigned short pid, unsigned int i) noexcept;
static int GetJournalItemType(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the actor refId at a certain index in a player's latest journal changes.
@ -140,28 +140,28 @@ public:
* Every journal change has an associated actor, which is usually the quest giver.
*
* \param pid The player ID whose journal changes should be used.
* \param i The index of the journalItem.
* \param index The index of the journalItem.
* \return The actor refId.
*/
static const char *GetJournalItemActorRefId(unsigned short pid, unsigned int i) noexcept;
static const char *GetJournalItemActorRefId(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the refId at a certain index in a player's latest kill count changes.
*
* \param pid The player ID whose kill count changes should be used.
* \param i The index of the kill count.
* \param index The index of the kill count.
* \return The refId.
*/
static const char *GetKillRefId(unsigned short pid, unsigned int i) noexcept;
static const char *GetKillRefId(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the number of kills at a certain index in a player's latest kill count changes.
*
* \param pid The player ID whose kill count changes should be used.
* \param i The index of the kill count.
* \param index The index of the kill count.
* \return The number of kills.
*/
static int GetKillNumber(unsigned short pid, unsigned int i) noexcept;
static int GetKillNumber(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the a certain player's reputation.

@ -71,7 +71,7 @@ void SpellFunctions::AddCustomSpellData(unsigned short pid, const char* spellId,
int index = -1;
for(int i = 0; i < player->spellbookChanges.spells.size(); i++)
{
if( strcmp(player->spellbookChanges.spells.at(i).mId.c_str(), spellId) == 0)
if( strcmp(player->spellbookChanges.spells.at(index).mId.c_str(), spellId) == 0)
{
index = i;
}
@ -93,7 +93,7 @@ void SpellFunctions::AddCustomSpellEffect(unsigned short pid, const char* spellI
int index = -1;
for(int i = 0; i < player->spellbookChanges.spells.size(); i++)
{
if( strcmp(player->spellbookChanges.spells.at(i).mId.c_str(), spellId) == 0)
if( strcmp(player->spellbookChanges.spells.at(index).mId.c_str(), spellId) == 0)
{
index = i;
}
@ -115,158 +115,158 @@ void SpellFunctions::AddCustomSpellEffect(unsigned short pid, const char* spellI
player->spellbookChanges.spells.at(index).mEffects.mList.push_back(effect);
}
const char *SpellFunctions::GetSpellId(unsigned short pid, unsigned int i) noexcept
const char *SpellFunctions::GetSpellId(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, "");
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return "invalid";
return player->spellbookChanges.spells.at(i).mId.c_str();
return player->spellbookChanges.spells.at(index).mId.c_str();
}
const char *SpellFunctions::GetSpellName(unsigned short pid, unsigned int i) noexcept
const char *SpellFunctions::GetSpellName(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, "");
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return "invalid";
return player->spellbookChanges.spells.at(i).mName.c_str();
return player->spellbookChanges.spells.at(index).mName.c_str();
}
int SpellFunctions::GetSpellType(unsigned short pid, unsigned int i) noexcept
int SpellFunctions::GetSpellType(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mData.mType;
return player->spellbookChanges.spells.at(index).mData.mType;
}
int SpellFunctions::GetSpellCost(unsigned short pid, unsigned int i) noexcept
int SpellFunctions::GetSpellCost(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mData.mCost;
return player->spellbookChanges.spells.at(index).mData.mCost;
}
int SpellFunctions::GetSpellFlags(unsigned short pid, unsigned int i) noexcept
int SpellFunctions::GetSpellFlags(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mData.mFlags;
return player->spellbookChanges.spells.at(index).mData.mFlags;
}
unsigned int SpellFunctions::GetSpellEffectCount(unsigned short pid, unsigned int i) noexcept
unsigned int SpellFunctions::GetSpellEffectCount(unsigned short pid, unsigned int index) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mEffects.mList.size();
return player->spellbookChanges.spells.at(index).mEffects.mList.size();
}
short SpellFunctions::GetSpellEffectId(unsigned short pid, unsigned int i, unsigned int j) noexcept
short SpellFunctions::GetSpellEffectId(unsigned short pid, unsigned int index, unsigned int j) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mEffects.mList.at(j).mEffectID;
return player->spellbookChanges.spells.at(index).mEffects.mList.at(j).mEffectID;
}
signed char SpellFunctions::GetSpellEffectSkill(unsigned short pid, unsigned int i, unsigned int j) noexcept
signed char SpellFunctions::GetSpellEffectSkill(unsigned short pid, unsigned int index, unsigned int j) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mEffects.mList.at(j).mSkill;
return player->spellbookChanges.spells.at(index).mEffects.mList.at(j).mSkill;
}
signed char SpellFunctions::GetSpellEffectAttribute(unsigned short pid, unsigned int i, unsigned int j) noexcept
signed char SpellFunctions::GetSpellEffectAttribute(unsigned short pid, unsigned int index, unsigned int j) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mEffects.mList.at(j).mAttribute;
return player->spellbookChanges.spells.at(index).mEffects.mList.at(j).mAttribute;
}
int SpellFunctions::GetSpellEffectRange(unsigned short pid, unsigned int i, unsigned int j) noexcept
int SpellFunctions::GetSpellEffectRange(unsigned short pid, unsigned int index, unsigned int j) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mEffects.mList.at(j).mRange;
return player->spellbookChanges.spells.at(index).mEffects.mList.at(j).mRange;
}
int SpellFunctions::GetSpellEffectArea(unsigned short pid, unsigned int i, unsigned int j) noexcept
int SpellFunctions::GetSpellEffectArea(unsigned short pid, unsigned int index, unsigned int j) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mEffects.mList.at(j).mArea;
return player->spellbookChanges.spells.at(index).mEffects.mList.at(j).mArea;
}
int SpellFunctions::GetSpellEffectDuration(unsigned short pid, unsigned int i, unsigned int j) noexcept
int SpellFunctions::GetSpellEffectDuration(unsigned short pid, unsigned int index, unsigned int j) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mEffects.mList.at(j).mDuration;
return player->spellbookChanges.spells.at(index).mEffects.mList.at(j).mDuration;
}
int SpellFunctions::GetSpellEffectMagnMin(unsigned short pid, unsigned int i, unsigned int j) noexcept
int SpellFunctions::GetSpellEffectMagnMin(unsigned short pid, unsigned int index, unsigned int j) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mEffects.mList.at(j).mMagnMin;
return player->spellbookChanges.spells.at(index).mEffects.mList.at(j).mMagnMin;
}
int SpellFunctions::GetSpellEffectMagnMax(unsigned short pid, unsigned int i, unsigned int j) noexcept
int SpellFunctions::GetSpellEffectMagnMax(unsigned short pid, unsigned int index, unsigned int j) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
if (i >= player->spellbookChanges.count)
if (index >= player->spellbookChanges.count)
return 0;
return player->spellbookChanges.spells.at(i).mEffects.mList.at(j).mMagnMax;
return player->spellbookChanges.spells.at(index).mEffects.mList.at(j).mMagnMax;
}
void SpellFunctions::SendSpellbookChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept

@ -121,135 +121,135 @@ public:
* \brief Get the spellId at a certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \return The spellId.
*/
static const char *GetSpellId(unsigned short pid, unsigned int i) noexcept;
static const char *GetSpellId(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the name of the spell at a certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \return The spell name.
*/
static const char *GetSpellName(unsigned short pid, unsigned int i) noexcept;
static const char *GetSpellName(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the type of the spell at a certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \return The spell type.
*/
static int GetSpellType(unsigned short pid, unsigned int i) noexcept;
static int GetSpellType(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the cost of the spell at a certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \return The spell cost.
*/
static int GetSpellCost(unsigned short pid, unsigned int i) noexcept;
static int GetSpellCost(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the flags of the spell at a certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \return The spell flags.
*/
static int GetSpellFlags(unsigned short pid, unsigned int i) noexcept;
static int GetSpellFlags(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the number of effects on the spell at a certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \return The spell effect count.
*/
static unsigned int GetSpellEffectCount(unsigned short pid, unsigned int i) noexcept;
static unsigned int GetSpellEffectCount(unsigned short pid, unsigned int index) noexcept;
/**
* \brief Get the effectId of the effect at a certain index in the spell at another certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \param j The index of the effect.
* \return The effectId.
*/
static short GetSpellEffectId(unsigned short pid, unsigned int i, unsigned int j) noexcept;
static short GetSpellEffectId(unsigned short pid, unsigned int index, unsigned int j) noexcept;
/**
* \brief Get the affected skill of the effect at a certain index in the spell at another certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \param j The index of the effect.
* \return The affected skill.
*/
static signed char GetSpellEffectSkill(unsigned short pid, unsigned int i, unsigned int j) noexcept;
static signed char GetSpellEffectSkill(unsigned short pid, unsigned int index, unsigned int j) noexcept;
/**
* \brief Get the affected attribute of the effect at a certain index in the spell at another certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \param j The index of the effect.
* \return The affected attribute.
*/
static signed char GetSpellEffectAttribute(unsigned short pid, unsigned int i, unsigned int j) noexcept;
static signed char GetSpellEffectAttribute(unsigned short pid, unsigned int index, unsigned int j) noexcept;
/**
* \brief Get the range of the effect at a certain index in the spell at another certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \param j The index of the effect.
* \return The range.
*/
static int GetSpellEffectRange(unsigned short pid, unsigned int i, unsigned int j) noexcept;
static int GetSpellEffectRange(unsigned short pid, unsigned int index, unsigned int j) noexcept;
/**
* \brief Get the area of the effect at a certain index in the spell at another certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \param j The index of the effect.
* \return The area.
*/
static int GetSpellEffectArea(unsigned short pid, unsigned int i, unsigned int j) noexcept;
static int GetSpellEffectArea(unsigned short pid, unsigned int index, unsigned int j) noexcept;
/**
* \brief Get the duration of the effect at a certain index in the spell at another certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \param j The index of the effect.
* \return The duration.
*/
static int GetSpellEffectDuration(unsigned short pid, unsigned int i, unsigned int j) noexcept;
static int GetSpellEffectDuration(unsigned short pid, unsigned int index, unsigned int j) noexcept;
/**
* \brief Get the minimum magnitude of the effect at a certain index in the spell at another certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \param j The index of the effect.
* \return The minimum magnitude.
*/
static int GetSpellEffectMagnMin(unsigned short pid, unsigned int i, unsigned int j) noexcept;
static int GetSpellEffectMagnMin(unsigned short pid, unsigned int index, unsigned int j) noexcept;
/**
* \brief Get the maximum magnitude of the effect at a certain index in the spell at another certain index in a player's latest spellbook changes.
*
* \param pid The player ID whose spellbook changes should be used.
* \param i The index of the spell.
* \param index The index of the spell.
* \param j The index of the effect.
* \return The maximum magnitude.
*/
static int GetSpellEffectMagnMax(unsigned short pid, unsigned int i, unsigned int j) noexcept;
static int GetSpellEffectMagnMax(unsigned short pid, unsigned int index, unsigned int j) noexcept;
/**
* \brief Send a PlayerSpellbook packet with a player's recorded spellbook changes.

@ -11,8 +11,8 @@
using namespace std;
using namespace mwmp;
BaseWorldstate writeWorldstate;
BaseWorldstate *readWorldstate;
BaseWorldstate writeWorldstate;
void WorldstateFunctions::ReadReceivedWorldstate() noexcept
{

@ -132,7 +132,7 @@ public:
* \brief Get the X coordinate of the cell corresponding to the map tile at a certain index in
* the read worldstate's map tiles.
*
* \param i The index of the map tile.
* \param index The index of the map tile.
* \return The X coordinate of the cell.
*/
static int GetMapTileCellX(unsigned int index) noexcept;
@ -141,7 +141,7 @@ public:
* \brief Get the Y coordinate of the cell corresponding to the map tile at a certain index in
* the read worldstate's map tiles.
*
* \param i The index of the map tile.
* \param index The index of the map tile.
* \return The Y coordinate of the cell.
*/
static int GetMapTileCellY(unsigned int index) noexcept;
@ -310,7 +310,7 @@ public:
* \brief Save the .png image data of the map tile at a certain index in the read worldstate's
* map changes.
*
* \param i The index of the map tile.
* \param index The index of the map tile.
* \param filePath The file path of the resulting file.
* \return void
*/

@ -146,43 +146,43 @@ boost::any LangLua::Call(const char *name, const char *argl, const std::vector<b
lua_getglobal (lua, name);
for (intptr_t i = 0; i < n_args; i++)
for (intptr_t index = 0; index < n_args; index++)
{
switch (argl[i])
switch (argl[index])
{
case 'i':
luabridge::Stack<unsigned int>::push(lua, boost::any_cast<unsigned int>(args.at(i)));
luabridge::Stack<unsigned int>::push(lua, boost::any_cast<unsigned int>(args.at(index)));
break;
case 'q':
luabridge::Stack<signed int>::push(lua, boost::any_cast<signed int>(args.at(i)));
luabridge::Stack<signed int>::push(lua, boost::any_cast<signed int>(args.at(index)));
break;
case 'l':
luabridge::Stack<unsigned long long>::push(lua, boost::any_cast<unsigned long long>(args.at(i)));
luabridge::Stack<unsigned long long>::push(lua, boost::any_cast<unsigned long long>(args.at(index)));
break;
case 'w':
luabridge::Stack<signed long long>::push(lua, boost::any_cast<signed long long>(args.at(i)));
luabridge::Stack<signed long long>::push(lua, boost::any_cast<signed long long>(args.at(index)));
break;
case 'f':
luabridge::Stack<double>::push(lua, boost::any_cast<double>(args.at(i)));
luabridge::Stack<double>::push(lua, boost::any_cast<double>(args.at(index)));
break;
case 'p':
luabridge::Stack<void *>::push(lua, boost::any_cast<void *>(args.at(i)));
luabridge::Stack<void *>::push(lua, boost::any_cast<void *>(args.at(index)));
break;
case 's':
luabridge::Stack<const char *>::push(lua, boost::any_cast<const char *>(args.at(i)));
luabridge::Stack<const char *>::push(lua, boost::any_cast<const char *>(args.at(index)));
break;
case 'b':
luabridge::Stack<bool>::push(lua, boost::any_cast<int>(args.at(i)));
luabridge::Stack<bool>::push(lua, boost::any_cast<int>(args.at(index)));
break;
default:
throw runtime_error("Lua call: Unknown argument identifier " + argl[i]);
throw runtime_error("Lua call: Unknown argument identifier " + argl[index]);
}
}

Loading…
Cancel
Save