mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Retransmit support added back in (stupid compile flags), prelim work on lua_client stuff, took out a few redundant or non-working functions
This commit is contained in:
+5
-5
@@ -7114,13 +7114,13 @@ const char* Client::GetClassPlural(Client* client) {
|
||||
|
||||
void Client::SendWebLink(const char *website)
|
||||
{
|
||||
if(website != 0)
|
||||
size_t len = strlen(website) + 1;
|
||||
if(website != 0 && len > 1)
|
||||
{
|
||||
std::string str = website;
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weblink, sizeof(Weblink_Struct) + str.length() + 1);
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Weblink, sizeof(Weblink_Struct) + len);
|
||||
Weblink_Struct *wl = (Weblink_Struct*)outapp->pBuffer;
|
||||
memcpy(wl->weblink, str.c_str(), str.length() + 1);
|
||||
wl->weblink[str.length() + 1] = '\0';
|
||||
memcpy(wl->weblink, website, len);
|
||||
wl->weblink[len] = '\0';
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
@@ -687,7 +687,6 @@ public:
|
||||
inline uint8 GetBecomeNPCLevel() const { return npclevel; }
|
||||
inline void SetBecomeNPC(bool flag) { npcflag = flag; }
|
||||
inline void SetBecomeNPCLevel(uint8 level) { npclevel = level; }
|
||||
bool LootToStack(uint32 itemid);
|
||||
void SetFeigned(bool in_feigned);
|
||||
/// this cures timing issues cuz dead animation isn't done but server side feigning is?
|
||||
inline bool GetFeigned() const { return(feigned); }
|
||||
|
||||
@@ -1914,50 +1914,6 @@ uint32 Client::GetEquipmentColor(uint8 material_slot) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Client::LootToStack(uint32 itemid) { //Loots stackable items to existing stacks - Wiz
|
||||
// @merth: Need to do loot code with new inventory struct
|
||||
/*
|
||||
const Item_Struct* item;
|
||||
int i;
|
||||
for (i=22; i<=29; i++) {
|
||||
item = GetItemAt(i);
|
||||
if (item) {
|
||||
if (m_pp.invitemproperties[i].charges < 20 && item->ID == itemid)
|
||||
{
|
||||
m_pp.invitemproperties[i].charges += 1;
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_PlaceItem, sizeof(Item_Struct));
|
||||
memcpy(outapp->pBuffer, item, outapp->size);
|
||||
Item_Struct* outitem = (Item_Struct*) outapp->pBuffer;
|
||||
outitem->equipSlot = i;
|
||||
outitem->charges = m_pp.invitemproperties[i].charges;
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i=0; i<=pp_containerinv_size; i++) {
|
||||
if (m_pp.containerinv[i] != 0xFFFF) {
|
||||
item = database.GetItem(m_pp.containerinv[i]);
|
||||
if (m_pp.bagitemproperties[i].charges < 20 && item->ID == itemid)
|
||||
{
|
||||
m_pp.bagitemproperties[i].charges += 1;
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_PlaceItem, sizeof(Item_Struct));
|
||||
memcpy(outapp->pBuffer, item, outapp->size);
|
||||
Item_Struct* outitem = (Item_Struct*) outapp->pBuffer;
|
||||
outitem->equipSlot = 250+i;
|
||||
outitem->charges = m_pp.bagitemproperties[i].charges;
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
// Send an item packet (including all subitems of the item)
|
||||
void Client::SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type)
|
||||
{
|
||||
|
||||
@@ -6,10 +6,25 @@
|
||||
|
||||
#include "masterentity.h"
|
||||
#include "lua_client.h"
|
||||
#include "../common/item.h"
|
||||
|
||||
struct InventoryWhere { };
|
||||
|
||||
luabind::scope lua_register_client() {
|
||||
return luabind::class_<Lua_Client, Lua_Mob>("Client")
|
||||
.def(luabind::constructor<>());
|
||||
}
|
||||
|
||||
luabind::scope lua_register_inventory_where() {
|
||||
return luabind::class_<InventoryWhere>("InventoryWhere")
|
||||
.enum_("constants")
|
||||
[
|
||||
luabind::value("Personal", static_cast<int>(invWherePersonal)),
|
||||
luabind::value("Bank", static_cast<int>(invWhereBank)),
|
||||
luabind::value("SharedBank", static_cast<int>(invWhereSharedBank)),
|
||||
luabind::value("Trading", static_cast<int>(invWhereTrading)),
|
||||
luabind::value("Cursor", static_cast<int>(invWhereCursor))
|
||||
];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+184
-200
@@ -11,6 +11,7 @@ namespace luabind {
|
||||
}
|
||||
|
||||
luabind::scope lua_register_client();
|
||||
luabind::scope lua_register_inventory_where();
|
||||
|
||||
class Lua_Client : public Lua_Mob
|
||||
{
|
||||
@@ -39,206 +40,189 @@ public:
|
||||
void Kick();
|
||||
void Disconnect();
|
||||
bool IsLD();
|
||||
WorldKick
|
||||
GetAnon
|
||||
Duck
|
||||
Stand
|
||||
SetGM
|
||||
SetPVP
|
||||
GetPVP
|
||||
GetGM
|
||||
SetBaseClass
|
||||
SetBaseRace
|
||||
SetBaseGender
|
||||
GetBaseFace
|
||||
GetLanguageSkill
|
||||
GetLastName
|
||||
GetLDoNPointsTheme
|
||||
GetBaseSTR
|
||||
GetBaseSTA
|
||||
GetBaseCHA
|
||||
GetBaseDEX
|
||||
GetBaseINT
|
||||
GetBaseAGI
|
||||
GetBaseWIS
|
||||
GetWeight
|
||||
GetEXP
|
||||
GetAAExp
|
||||
GetTotalSecondsPlayed
|
||||
UpdateLDoNPoints
|
||||
SetDeity
|
||||
AddEXP
|
||||
SetEXP
|
||||
SetBindPoint
|
||||
GetBindX
|
||||
GetBindY
|
||||
GetBindZ
|
||||
GetBindHeading
|
||||
GetBindZoneID
|
||||
MovePC
|
||||
MovePCInstance
|
||||
ChangeLastName
|
||||
GetFactionLevel
|
||||
SetFactionLevel
|
||||
SetFactionLevel2
|
||||
GetRawItemAC
|
||||
AccountID
|
||||
AccountName
|
||||
Admin
|
||||
CharacterID
|
||||
UpdateAdmin
|
||||
UpdateWho
|
||||
GuildRank
|
||||
GuildID
|
||||
GetFace
|
||||
TakeMoneyFromPP
|
||||
AddMoneyToPP
|
||||
TGB
|
||||
GetSkillPoints
|
||||
SetSkillPoints
|
||||
IncreaseSkill
|
||||
IncreaseLanguageSkill
|
||||
GetSkill
|
||||
GetRawSkill
|
||||
HasSkill
|
||||
CanHaveSkill
|
||||
SetSkill
|
||||
AddSkill
|
||||
CheckSpecializeIncrease
|
||||
CheckIncreaseSkill
|
||||
SetLanguageSkill
|
||||
MaxSkill
|
||||
GMKill
|
||||
IsMedding
|
||||
GetDuelTarget
|
||||
IsDueling
|
||||
SetDuelTarget
|
||||
SetDueling
|
||||
ResetAA
|
||||
MemSpell
|
||||
UnmemSpell
|
||||
UnmemSpellAll
|
||||
ScribeSpell
|
||||
UnscribeSpell
|
||||
UnscribeSpellAll
|
||||
UntrainDisc
|
||||
UntrainDiscAll
|
||||
IsSitting
|
||||
IsBecomeNPC
|
||||
GetBecomeNPCLevel
|
||||
SetBecomeNPC
|
||||
SetBecomeNPCLevel
|
||||
LootToStack
|
||||
SetFeigned
|
||||
GetFeigned
|
||||
AutoSplitEnabled
|
||||
SetHorseId
|
||||
GetHorseId
|
||||
NukeItem
|
||||
SetTint
|
||||
SetMaterial
|
||||
Undye
|
||||
GetItemIDAt
|
||||
GetAugmentIDAt
|
||||
DeleteItemInInventory
|
||||
SummonItem
|
||||
SetStats
|
||||
IncStats
|
||||
DropItem
|
||||
BreakInvis
|
||||
GetGroup
|
||||
LeaveGroup
|
||||
GetRaid
|
||||
IsGrouped
|
||||
IsRaidGrouped
|
||||
Hungry
|
||||
Thirsty
|
||||
GetInstrumentMod
|
||||
DecreaseByID
|
||||
SlotConvert2
|
||||
Escape
|
||||
RemoveNoRent
|
||||
GoFish
|
||||
ForageItem
|
||||
CalcPriceMod
|
||||
ResetTrade
|
||||
UseDiscipline
|
||||
GetCharacterFactionLevel
|
||||
SetZoneFlag
|
||||
ClearZoneFlag
|
||||
HasZoneFlag
|
||||
SendZoneFlagInfo
|
||||
LoadZoneFlags
|
||||
SetAATitle
|
||||
GetClientVersion
|
||||
GetClientVersionBit
|
||||
SetTitleSuffix
|
||||
SetAAPoints
|
||||
GetAAPoints
|
||||
GetSpentAA
|
||||
AddAAPoints
|
||||
RefundAA
|
||||
GetModCharacterFactionLevel
|
||||
GetLDoNWins
|
||||
GetLDoNLosses
|
||||
GetLDoNWinsTheme
|
||||
GetLDoNLossesTheme
|
||||
GetItemAt
|
||||
GetAugmentAt
|
||||
GetStartZone
|
||||
SetStartZone
|
||||
KeyRingAdd
|
||||
KeyRingCheck
|
||||
AddPVPPoints
|
||||
AddCrystals
|
||||
GetPVPPoints
|
||||
GetRadiantCrystals
|
||||
GetEbonCrystals
|
||||
ReadBook
|
||||
UpdateGroupAAs
|
||||
GetGroupPoints
|
||||
GetRaidPoints
|
||||
LearnRecipe
|
||||
GetEndurance
|
||||
GetMaxEndurance
|
||||
GetEnduranceRatio
|
||||
SetEndurance
|
||||
SendOPTranslocateConfirm
|
||||
NPCSpawn
|
||||
GetIP
|
||||
AddLevelBasedExp
|
||||
IncrementAA
|
||||
GetAALevel
|
||||
MarkCompassLoc
|
||||
ClearCompassMark
|
||||
GetFreeSpellBookSlot
|
||||
GetSpellBookSlotBySpellID
|
||||
UpdateTaskActivity
|
||||
AssignTask
|
||||
FailTask
|
||||
IsTaskCompleted
|
||||
IsTaskActive
|
||||
IsTaskActivityActive
|
||||
GetCorpseCount
|
||||
GetCorpseID
|
||||
GetCorpseItemAt
|
||||
AssignToInstance
|
||||
Freeze
|
||||
UnFreeze
|
||||
GetAggroCount
|
||||
GetCarriedMoney
|
||||
GetAllMoney
|
||||
GetItemInInventory
|
||||
SetCustomItemData
|
||||
GetCustomItemData
|
||||
OpenLFGuildWindow
|
||||
SignalClient
|
||||
AddAlternateCurrencyValue
|
||||
SendWebLink
|
||||
GetInstanceID
|
||||
HasSpellScribed
|
||||
SetAccountFlag
|
||||
GetAccountFlag
|
||||
void WorldKick();
|
||||
bool GetAnon();
|
||||
void Duck();
|
||||
void Stand();
|
||||
void SetGM(bool v);
|
||||
void SetPVP(bool v);
|
||||
bool GetPVP();
|
||||
bool GetGM();
|
||||
void SetBaseClass(int v);
|
||||
void SetBaseRace(int v);
|
||||
void SetBaseGender(int v);
|
||||
int GetBaseFace();
|
||||
int GetLanguageSkill();
|
||||
int GetLastName();
|
||||
int GetLDoNPointsTheme();
|
||||
int GetBaseSTR();
|
||||
int GetBaseSTA();
|
||||
int GetBaseCHA();
|
||||
int GetBaseDEX();
|
||||
int GetBaseINT();
|
||||
int GetBaseAGI();
|
||||
int GetBaseWIS();
|
||||
int GetWeight();
|
||||
uint32 GetEXP();
|
||||
uint32 GetAAExp();
|
||||
uint32 GetTotalSecondsPlayed();
|
||||
void UpdateLDoNPoints(int points, uint32 theme);
|
||||
void SetDeity(int v);
|
||||
void AddEXP(uint32 add_exp, int conlevel = 255, bool resexp = false);
|
||||
void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp = false);
|
||||
SetBindPoint(int to_zone = -1, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f);
|
||||
float GetBindX(int index = 0);
|
||||
float GetBindY(int index = 0);
|
||||
float GetBindZ(int index = 0);
|
||||
float GetBindHeading(int index = 0);
|
||||
uint32 GetBindZoneID(int index = 0);
|
||||
void MovePC(int zone, float x, float y, float z, float heading);
|
||||
void MovePCInstance(int zone, int instance, float x, float y, float z, float heading);
|
||||
void ChangeLastName(const char *in);
|
||||
int GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 race, uint32 class, uint32 deity, uint32 faction, Lua_NPC npc);
|
||||
void SetFactionLevel(uint32 char_id, uint32 npc_id, int char_class, int char_race, int char_deity);
|
||||
void SetFactionLevel2(uint32 char_id, int faction_id, int char_class, int char_race, int char_deity, int value, int temp);
|
||||
int GetRawItemAC();
|
||||
uint32 AccountID();
|
||||
const char *AccountName();
|
||||
bool Admin();
|
||||
uint32 CharacterID();
|
||||
int GuildRank();
|
||||
uint32 GuildID();
|
||||
int GetFace();
|
||||
bool TakeMoneyFromPP(uint64 copper, bool update_client = false);
|
||||
void AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool update_client = false);
|
||||
bool TGB();
|
||||
int GetSkillPoints();
|
||||
void SetSkillPoints(int skill);
|
||||
void IncreaseSkill(int skill_id, int value);
|
||||
void IncreaseLanguageSkill(int skill_id, int value);
|
||||
int GetRawSkill(int skill_id);
|
||||
bool HasSkill(int skill_id);
|
||||
bool CanHaveSkill(int skill_id);
|
||||
void SetSkill(int skill_id, int value);
|
||||
void AddSkill(int skill_id, int value);
|
||||
void CheckSpecializeIncrease(int spell_id);
|
||||
void CheckIncreaseSkill(int skill_id, Lua_Mob target, int chance_mod = 0);
|
||||
void SetLanguageSkill(int language, int value);
|
||||
int MaxSkill(int spell_id);
|
||||
bool IsMedding();
|
||||
Lua_Client GetDuelTarget();
|
||||
bool IsDueling();
|
||||
void SetDuelTarget(Lua_Client c);
|
||||
void SetDueling(bool v);
|
||||
void ResetAA();
|
||||
void MemSpell(int spell_id, int slot, bool update_client = true);
|
||||
void UnmemSpell(int slot, bool update_client = true);
|
||||
void UnmemSpellAll(bool update_client = true);
|
||||
void ScribeSpell(int spell_id, int slot, bool update_client = true);
|
||||
void UnscribeSpell(int slot, bool update_client = true);
|
||||
void UnscribeSpellAll(bool update_client = true);
|
||||
void UntrainDisc(int slot, bool update_client = true);
|
||||
void UntrainDiscAll(bool update_client = true);
|
||||
bool IsSitting();
|
||||
void SetFeigned(bool v);
|
||||
bool GetFeigned();
|
||||
bool AutoSplitEnabled();
|
||||
void SetHorseId(int id);
|
||||
int GetHorseId();
|
||||
void NukeItem(uint32 item_num, int where_to_check);
|
||||
void SetTint(int slot_id, uint32 color);
|
||||
void SetMaterial(int slot_id, uint32 item_id);
|
||||
void Undye(int slot_id);
|
||||
int GetItemIDAt(int slot_id);
|
||||
int GetAugmentIDAt(int slot_id, int aug_slot);
|
||||
void DeleteItemInInventory(int slot_id, int quantity, bool update_client = true);
|
||||
void SummonItem(uint32 item_id, int charges = 0, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0,
|
||||
uint32 aug5 = 0, bool attuned = false, int to_slot = 30);
|
||||
void SetStats(int type, int value);
|
||||
void IncStats(int type, int value);
|
||||
int DropItem(int slot_id);
|
||||
void BreakInvis();
|
||||
void LeaveGroup();
|
||||
bool IsGrouped();
|
||||
bool IsRaidGrouped();
|
||||
bool Hungry();
|
||||
bool Thirsty();
|
||||
int GetInstrumentMod(int spell_id);
|
||||
bool DecreaseByID(uint32 type, int amt);
|
||||
void Escape();
|
||||
void GoFish();
|
||||
void ForageItem(bool guarantee = false);
|
||||
float CalcPriceMod(Lua_Mob other, bool reverse);
|
||||
void ResetTrade();
|
||||
bool UseDiscipline(int spell_id, int target_id);
|
||||
int GetCharacterFactionLevel(int faction_id);
|
||||
void SetZoneFlag(int zone_id);
|
||||
void ClearZoneFlag(int zone_id);
|
||||
bool HasZoneFlag(int zone_id);
|
||||
void SendZoneFlagInfo(Lua_Client to);
|
||||
void SetAATitle(const char *title);
|
||||
int GetClientVersion();
|
||||
uint32 GetClientVersionBit();
|
||||
void SetTitleSuffix(const char *text);
|
||||
void SetAAPoints(int points);
|
||||
int GetAAPoints();
|
||||
int GetSpentAA();
|
||||
void AddAAPoints(int points);
|
||||
void RefundAA();
|
||||
int GetModCharacterFactionLevel(int faction);
|
||||
int GetLDoNWins();
|
||||
int GetLDoNLosses();
|
||||
int GetLDoNWinsTheme(int theme);
|
||||
int GetLDoNLossesTheme(int theme);
|
||||
Lua_ItemInst GetItemAt(int slot);
|
||||
int GetStartZone();
|
||||
void SetStartZone(int zone_id, float x = 0.0f, float y = 0.0f, float z = 0.0f);
|
||||
void KeyRingAdd(uint32 item);
|
||||
bool KeyRingCheck(uint32 item);
|
||||
void AddPVPPoints(uint32 points);
|
||||
void AddCrystals(uint32 radiant, uint32 ebon);
|
||||
uint32 GetPVPPoints();
|
||||
uint32 GetRadiantCrystals();
|
||||
uint32 GetEbonCrystals();
|
||||
void ReadBook(const char *text, int type);
|
||||
void UpdateGroupAAs(int points, uint32 type);
|
||||
uint32 GetGroupPoints();
|
||||
uint32 GetRaidPoints();
|
||||
void LearnRecipe(uint32 recipe);
|
||||
int GetEndurance();
|
||||
int GetMaxEndurance();
|
||||
int GetEndurancePercent();
|
||||
void SetEndurance(int endur);
|
||||
void SendOPTranslocateConfirm(Lua_Mob caster, int spell_id);
|
||||
const char *GetIP();
|
||||
void AddLevelBasedExp(int exp_pct, int max_level = 0);
|
||||
void IncrementAA(int aa);
|
||||
MarkSingleCompassLoc(float in_x, float in_y, float in_z, int count = 1);
|
||||
int GetFreeSpellBookSlot(int start = 0);
|
||||
int GetSpellBookSlotBySpellID(int spell_id);
|
||||
void UpdateTaskActivity(int task, int activity, int count);
|
||||
void AssignTask(int task, int npc_id);
|
||||
void FailTask(int task);
|
||||
bool IsTaskCompleted(int task);
|
||||
bool IsTaskActive(int task);
|
||||
bool IsTaskActivityActive(int task, int activty);
|
||||
int GetCorpseCount();
|
||||
int GetCorpseID(int corpse);
|
||||
int GetCorpseItemAt(int corpse, int slot);
|
||||
void AssignToInstance(int instance_id);
|
||||
void Freeze();
|
||||
void UnFreeze();
|
||||
int GetAggroCount();
|
||||
uint64 GetCarriedMoney();
|
||||
uint64 GetAllMoney();
|
||||
void OpenLFGuildWindow();
|
||||
void Signal(uint32 id);
|
||||
void AddAlternateCurrencyValue(uint32 currency, int amount);
|
||||
void SendWebLink(const char *site);
|
||||
bool HasSpellScribed(int spell_id);
|
||||
void SetAccountFlag(std::string flag, std::string val);
|
||||
std::string value GetAccountFlag(std::string flag);
|
||||
|
||||
//unsup features
|
||||
Lua_Group GetGroup();
|
||||
Lua_Raid GetRaid();
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
@@ -12,20 +12,6 @@ struct Lua_HateList;
|
||||
class Lua_Item;
|
||||
class Lua_ItemInst;
|
||||
|
||||
//TODO: Remove the error checking by a flag since this adds significant overhead to each c call
|
||||
#define Lua_Safe_Call_Void() if(!d_) { return; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Bool() if(!d_) { return false; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Int() if(!d_) { return 0; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Real() if(!d_) { return 0.0; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_String() if(!d_) { return ""; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Entity() if(!d_) { return Lua_Entity(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Mob() if(!d_) { return Lua_Mob(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_NPC() if(!d_) { return Lua_NPC(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Client() if(!d_) { return Lua_Client(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_HateList() if(!d_) { return Lua_HateList(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Item() if(!d_) { return Lua_Item(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_ItemInst() if(!d_) { return Lua_ItemInst(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
|
||||
namespace luabind {
|
||||
struct scope;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
luabind::scope lua_register_general();
|
||||
luabind::scope lua_register_events();
|
||||
luabind::scope lua_register_faction();
|
||||
luabind::scope lua_register_slot();
|
||||
luabind::scope lua_register_material();
|
||||
luabind::scope lua_register_client_version();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <luabind/object.hpp>
|
||||
|
||||
#include "masterentity.h"
|
||||
#include "lua_entity.h"
|
||||
#include "lua_item.h"
|
||||
|
||||
Lua_Item::Lua_Item(uint32 item_id) {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "masterentity.h"
|
||||
#include "lua_iteminst.h"
|
||||
#include "lua_item.h"
|
||||
#include "lua_entity.h"
|
||||
|
||||
bool Lua_ItemInst::IsType(int item_class) {
|
||||
Lua_Safe_Call_Bool();
|
||||
|
||||
+7
-1
@@ -1682,6 +1682,11 @@ int Lua_Mob::GetFlurryChance() {
|
||||
return self->GetFlurryChance();
|
||||
}
|
||||
|
||||
int Lua_Mob::GetSkill(int skill) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetSkill(static_cast<SkillType>(skill));
|
||||
}
|
||||
|
||||
luabind::scope lua_register_mob() {
|
||||
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
|
||||
.def(luabind::constructor<>())
|
||||
@@ -1977,7 +1982,8 @@ luabind::scope lua_register_mob() {
|
||||
.def("SetDisableMelee", (void(Lua_Mob::*)(bool))&Lua_Mob::SetDisableMelee)
|
||||
.def("IsMeleeDisabled", (bool(Lua_Mob::*)(void))&Lua_Mob::IsMeleeDisabled)
|
||||
.def("SetFlurryChance", (void(Lua_Mob::*)(int))&Lua_Mob::SetFlurryChance)
|
||||
.def("GetFlurryChance", (int(Lua_Mob::*)(void))&Lua_Mob::GetFlurryChance);
|
||||
.def("GetFlurryChance", (int(Lua_Mob::*)(void))&Lua_Mob::GetFlurryChance)
|
||||
.def("GetSkill", (int(Lua_Mob::*)(int))&Lua_Mob::GetSkill);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -336,6 +336,7 @@ public:
|
||||
bool IsMeleeDisabled();
|
||||
void SetFlurryChance(int value);
|
||||
int GetFlurryChance();
|
||||
int GetSkill(int skill_id);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+2
-49
@@ -806,6 +806,7 @@ void LuaParser::MapFunctions(lua_State *L) {
|
||||
lua_register_mob(),
|
||||
lua_register_npc(),
|
||||
lua_register_client(),
|
||||
lua_register_inventory_where(),
|
||||
lua_register_iteminst(),
|
||||
lua_register_item(),
|
||||
lua_register_spell(),
|
||||
@@ -946,56 +947,8 @@ void LuaParser::ExportQGlobals(NPC *n, Client *c) {
|
||||
return;
|
||||
}
|
||||
|
||||
QGlobalCache *npc_c = nullptr;
|
||||
QGlobalCache *char_c = nullptr;
|
||||
QGlobalCache *zone_c = nullptr;
|
||||
uint32 npc_id = 0;
|
||||
uint32 char_id = 0;
|
||||
uint32 zone_id = 0;
|
||||
|
||||
if(n) {
|
||||
npc_id = n->GetNPCTypeID();
|
||||
npc_c = n->GetQGlobals();
|
||||
}
|
||||
|
||||
if(c) {
|
||||
char_id = c->CharacterID();
|
||||
char_c = c->GetQGlobals();
|
||||
}
|
||||
|
||||
if(zone) {
|
||||
zone_id = zone->GetZoneID();
|
||||
zone_c = zone->GetQGlobals();
|
||||
}
|
||||
|
||||
if(!npc_c && n) {
|
||||
npc_c = n->CreateQGlobals();
|
||||
npc_c->LoadByNPCID(npc_id);
|
||||
}
|
||||
|
||||
if(!char_c && c) {
|
||||
char_c = c->CreateQGlobals();
|
||||
char_c->LoadByCharID(char_id);
|
||||
}
|
||||
|
||||
if(!zone_c && zone) {
|
||||
zone_c = zone->CreateQGlobals();
|
||||
zone_c->LoadByZoneID(zone_id);
|
||||
zone_c->LoadByGlobalContext();
|
||||
}
|
||||
|
||||
std::list<QGlobal> global_map;
|
||||
if(npc_c) {
|
||||
QGlobalCache::Combine(global_map, npc_c->GetBucket(), npc_id, char_id, zone_id);
|
||||
}
|
||||
|
||||
if(char_c) {
|
||||
QGlobalCache::Combine(global_map, char_c->GetBucket(), npc_id, char_id, zone_id);
|
||||
}
|
||||
|
||||
if(zone_c) {
|
||||
QGlobalCache::Combine(global_map, zone_c->GetBucket(), npc_id, char_id, zone_id);
|
||||
}
|
||||
QGlobalCache::GetQGlobals(global_map, n, c, zone);
|
||||
|
||||
auto iter = global_map.begin();
|
||||
while(iter != global_map.end()) {
|
||||
|
||||
@@ -2,6 +2,20 @@
|
||||
#define EQEMU_LUA_PTR_H
|
||||
#ifdef LUA_EQEMU
|
||||
|
||||
//TODO: Remove the error checking by a flag since this adds significant overhead to each c call
|
||||
#define Lua_Safe_Call_Void() if(!d_) { return; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Bool() if(!d_) { return false; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Int() if(!d_) { return 0; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Real() if(!d_) { return 0.0; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_String() if(!d_) { return ""; } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Entity() if(!d_) { return Lua_Entity(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Mob() if(!d_) { return Lua_Mob(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_NPC() if(!d_) { return Lua_NPC(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Client() if(!d_) { return Lua_Client(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_HateList() if(!d_) { return Lua_HateList(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_Item() if(!d_) { return Lua_Item(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
#define Lua_Safe_Call_ItemInst() if(!d_) { return Lua_ItemInst(); } NativeType *self = reinterpret_cast<NativeType*>(d_)
|
||||
|
||||
template<typename T>
|
||||
class Lua_Ptr
|
||||
{
|
||||
|
||||
@@ -2713,33 +2713,6 @@ XS(XS_Client_SetBecomeNPCLevel)
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Client_LootToStack); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_LootToStack)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: Client::LootToStack(THIS, itemid)");
|
||||
{
|
||||
Client * THIS;
|
||||
bool RETVAL;
|
||||
uint32 itemid = (uint32)SvUV(ST(1));
|
||||
|
||||
if (sv_derived_from(ST(0), "Client")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(Client *,tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type Client");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->LootToStack(itemid);
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Client_SetFeigned); /* prototype to pass -Wmissing-prototypes */
|
||||
XS(XS_Client_SetFeigned)
|
||||
{
|
||||
@@ -5854,7 +5827,6 @@ XS(boot_Client)
|
||||
newXSproto(strcpy(buf, "GetBecomeNPCLevel"), XS_Client_GetBecomeNPCLevel, file, "$");
|
||||
newXSproto(strcpy(buf, "SetBecomeNPC"), XS_Client_SetBecomeNPC, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetBecomeNPCLevel"), XS_Client_SetBecomeNPCLevel, file, "$$");
|
||||
newXSproto(strcpy(buf, "LootToStack"), XS_Client_LootToStack, file, "$$");
|
||||
newXSproto(strcpy(buf, "SetFeigned"), XS_Client_SetFeigned, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetFeigned"), XS_Client_GetFeigned, file, "$");
|
||||
newXSproto(strcpy(buf, "AutoSplitEnabled"), XS_Client_AutoSplitEnabled, file, "$");
|
||||
|
||||
Reference in New Issue
Block a user