mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 03:11:28 +00:00
Changed a bunch of lua stuff, as well as modified a bunch of generic item quest stuff
This commit is contained in:
parent
1363d5d209
commit
ce63503bab
@ -167,7 +167,7 @@ protected:
|
|||||||
// Dirs
|
// Dirs
|
||||||
MapDir="Maps";
|
MapDir="Maps";
|
||||||
QuestDir="quests";
|
QuestDir="quests";
|
||||||
PluginDir="quests/plugins";
|
PluginDir="plugins";
|
||||||
|
|
||||||
// Launcher
|
// Launcher
|
||||||
LogPrefix = "logs/zone-";
|
LogPrefix = "logs/zone-";
|
||||||
|
|||||||
@ -2065,15 +2065,11 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
|||||||
{
|
{
|
||||||
ItemInst* p_inst = (ItemInst*)inst;
|
ItemInst* p_inst = (ItemInst*)inst;
|
||||||
|
|
||||||
if(parse->ItemHasQuestSub(p_inst, "EVENT_ITEM_CLICK"))
|
int i = parse->EventItem(EVENT_ITEM_CLICK, this, p_inst, p_inst->GetID(), slot_id);
|
||||||
|
inst = m_inv[slot_id];
|
||||||
|
if(!inst)
|
||||||
{
|
{
|
||||||
parse->EventItem(EVENT_ITEM_CLICK, this, p_inst, p_inst->GetID(), slot_id);
|
return;
|
||||||
inst = m_inv[slot_id];
|
|
||||||
if (!inst)
|
|
||||||
{
|
|
||||||
// Item was deleted by the perl event
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
@ -2124,19 +2120,14 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
if(GetLevel() >= item->Click.Level2)
|
if(GetLevel() >= item->Click.Level2)
|
||||||
{
|
{
|
||||||
if(parse->ItemHasQuestSub(p_inst, "EVENT_ITEM_CLICK_CAST"))
|
int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, p_inst->GetID(), slot_id);
|
||||||
|
inst = m_inv[slot_id];
|
||||||
|
if(!inst)
|
||||||
{
|
{
|
||||||
//TODO: need to enforce and set recast timers here because the spell may not be cast.
|
return;
|
||||||
parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, p_inst->GetID(), slot_id);
|
|
||||||
inst = m_inv[slot_id];
|
|
||||||
if (!inst)
|
|
||||||
{
|
|
||||||
// Item was deleted by the perl event
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if(i != 0) {
|
||||||
CastSpell(item->Click.Effect, target_id, 10, item->CastTime, 0, 0, slot_id);
|
CastSpell(item->Click.Effect, target_id, 10, item->CastTime, 0, 0, slot_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2156,22 +2147,16 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
if(GetLevel() >= augitem->Click.Level2)
|
if(GetLevel() >= augitem->Click.Level2)
|
||||||
{
|
{
|
||||||
if(parse->ItemHasQuestSub(clickaug, "EVENT_ITEM_CLICK_CAST"))
|
int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, clickaug, clickaug->GetID(), slot_id);
|
||||||
{
|
inst = m_inv[slot_id];
|
||||||
//TODO: need to enforce and set recast timers here because the spell may not be cast.
|
if(!inst)
|
||||||
parse->EventItem(EVENT_ITEM_CLICK_CAST, this, clickaug, clickaug->GetID(), slot_id);
|
{
|
||||||
inst = m_inv[slot_id];
|
return;
|
||||||
if (!inst)
|
}
|
||||||
{
|
|
||||||
// Item was deleted by the perl event
|
if(i != 0) {
|
||||||
return;
|
CastSpell(augitem->Click.Effect, target_id, 10, augitem->CastTime, 0, 0, slot_id);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//We assume augs aren't consumable
|
|
||||||
CastSpell(augitem->Click.Effect, target_id, 10, augitem->CastTime, 0, 0, slot_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4616,16 +4601,14 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
|
|||||||
if(GetLevel() >= item->Click.Level2)
|
if(GetLevel() >= item->Click.Level2)
|
||||||
{
|
{
|
||||||
ItemInst* p_inst = (ItemInst*)inst;
|
ItemInst* p_inst = (ItemInst*)inst;
|
||||||
if(parse->ItemHasQuestSub(p_inst, "EVENT_ITEM_CLICK_CAST"))
|
int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, p_inst->GetID(), castspell->inventoryslot);
|
||||||
{
|
|
||||||
parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, p_inst->GetID(), castspell->inventoryslot);
|
if(i != 0) {
|
||||||
|
CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot);
|
||||||
|
} else {
|
||||||
SendSpellBarEnable(castspell->spell_id);
|
SendSpellBarEnable(castspell->spell_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4637,16 +4620,14 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemInst* p_inst = (ItemInst*)inst;
|
ItemInst* p_inst = (ItemInst*)inst;
|
||||||
if(parse->ItemHasQuestSub(p_inst, "EVENT_ITEM_CLICK_CAST"))
|
int i = parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, p_inst->GetID(), castspell->inventoryslot);
|
||||||
{
|
|
||||||
parse->EventItem(EVENT_ITEM_CLICK_CAST, this, p_inst, p_inst->GetID(), castspell->inventoryslot);
|
if(i != 0) {
|
||||||
|
CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot);
|
||||||
|
} else {
|
||||||
SendSpellBarEnable(castspell->spell_id);
|
SendSpellBarEnable(castspell->spell_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -10515,11 +10496,9 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) {
|
|||||||
if(its->Complete == 1) {
|
if(its->Complete == 1) {
|
||||||
|
|
||||||
int SpellID = PendingTranslocateData.SpellID;
|
int SpellID = PendingTranslocateData.SpellID;
|
||||||
if(parse->SpellHasQuestSub(SpellID, "EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE"))
|
int i = parse->EventSpell(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE, nullptr, this, SpellID, 0);
|
||||||
{
|
|
||||||
parse->EventSpell(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE, nullptr, this, SpellID, 0);
|
if(i != 0)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// If the spell has a translocate to bind effect, AND we are already in the zone the client
|
// If the spell has a translocate to bind effect, AND we are already in the zone the client
|
||||||
// is bound in, use the GoToBind method. If we send OP_Translocate in this case, the client moves itself
|
// is bound in, use the GoToBind method. If we send OP_Translocate in this case, the client moves itself
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
#ifdef LUA_EQEMU
|
#ifdef LUA_EQEMU
|
||||||
|
|
||||||
#include "masterentity.h"
|
|
||||||
#include "lua_client.h"
|
|
||||||
|
|
||||||
#include "lua.hpp"
|
#include "lua.hpp"
|
||||||
#include <luabind/luabind.hpp>
|
#include <luabind/luabind.hpp>
|
||||||
|
#include <luabind/object.hpp>
|
||||||
|
|
||||||
|
#include "masterentity.h"
|
||||||
|
#include "lua_client.h"
|
||||||
|
|
||||||
luabind::scope lua_register_client() {
|
luabind::scope lua_register_client() {
|
||||||
return luabind::class_<Lua_Client, Lua_Mob>("Client")
|
return luabind::class_<Lua_Client, Lua_Mob>("Client")
|
||||||
|
|||||||
@ -28,6 +28,218 @@ public:
|
|||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void SendSound();
|
||||||
|
void Save();
|
||||||
|
void Save(bool commit_now);
|
||||||
|
void SaveBackup();
|
||||||
|
bool Connected();
|
||||||
|
bool InZone();
|
||||||
|
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
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,14 +1,15 @@
|
|||||||
#ifdef LUA_EQEMU
|
#ifdef LUA_EQEMU
|
||||||
|
|
||||||
|
#include "lua.hpp"
|
||||||
|
#include <luabind/luabind.hpp>
|
||||||
|
#include <luabind/object.hpp>
|
||||||
|
|
||||||
#include "masterentity.h"
|
#include "masterentity.h"
|
||||||
#include "lua_entity.h"
|
#include "lua_entity.h"
|
||||||
#include "lua_mob.h"
|
#include "lua_mob.h"
|
||||||
#include "lua_client.h"
|
#include "lua_client.h"
|
||||||
#include "lua_npc.h"
|
#include "lua_npc.h"
|
||||||
|
|
||||||
#include "lua.hpp"
|
|
||||||
#include <luabind/luabind.hpp>
|
|
||||||
|
|
||||||
bool Lua_Entity::IsClient() {
|
bool Lua_Entity::IsClient() {
|
||||||
Lua_Safe_Call_Bool();
|
Lua_Safe_Call_Bool();
|
||||||
return self->IsClient();
|
return self->IsClient();
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include "lua.hpp"
|
#include "lua.hpp"
|
||||||
#include <luabind/luabind.hpp>
|
#include <luabind/luabind.hpp>
|
||||||
|
#include <luabind/object.hpp>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
#ifdef LUA_EQEMU
|
#ifdef LUA_EQEMU
|
||||||
|
|
||||||
|
#include "lua.hpp"
|
||||||
|
#include <luabind/luabind.hpp>
|
||||||
|
#include <luabind/object.hpp>
|
||||||
|
|
||||||
#include "masterentity.h"
|
#include "masterentity.h"
|
||||||
#include "lua_entity.h"
|
#include "lua_entity.h"
|
||||||
#include "lua_item.h"
|
#include "lua_item.h"
|
||||||
|
|
||||||
#include "lua.hpp"
|
|
||||||
#include <luabind/luabind.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
Lua_Item::Lua_Item(uint32 item_id) {
|
Lua_Item::Lua_Item(uint32 item_id) {
|
||||||
const Item_Struct *t = database.GetItem(item_id);
|
const Item_Struct *t = database.GetItem(item_id);
|
||||||
SetLuaPtrData(t);
|
SetLuaPtrData(t);
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
#ifdef LUA_EQEMU
|
#ifdef LUA_EQEMU
|
||||||
|
|
||||||
|
#include "lua.hpp"
|
||||||
|
#include <luabind/luabind.hpp>
|
||||||
|
#include <luabind/object.hpp>
|
||||||
|
|
||||||
#include "masterentity.h"
|
#include "masterentity.h"
|
||||||
#include "lua_iteminst.h"
|
#include "lua_iteminst.h"
|
||||||
#include "lua_item.h"
|
#include "lua_item.h"
|
||||||
#include "lua_entity.h"
|
#include "lua_entity.h"
|
||||||
|
|
||||||
#include "lua.hpp"
|
|
||||||
#include <luabind/luabind.hpp>
|
|
||||||
|
|
||||||
bool Lua_ItemInst::IsType(int item_class) {
|
bool Lua_ItemInst::IsType(int item_class) {
|
||||||
Lua_Safe_Call_Bool();
|
Lua_Safe_Call_Bool();
|
||||||
return self->IsType(static_cast<ItemClass>(item_class));
|
return self->IsType(static_cast<ItemClass>(item_class));
|
||||||
|
|||||||
185
zone/lua_mob.cpp
185
zone/lua_mob.cpp
@ -1,5 +1,9 @@
|
|||||||
#ifdef LUA_EQEMU
|
#ifdef LUA_EQEMU
|
||||||
|
|
||||||
|
#include "lua.hpp"
|
||||||
|
#include <luabind/luabind.hpp>
|
||||||
|
#include <luabind/object.hpp>
|
||||||
|
|
||||||
#include "masterentity.h"
|
#include "masterentity.h"
|
||||||
#include "lua_item.h"
|
#include "lua_item.h"
|
||||||
#include "lua_iteminst.h"
|
#include "lua_iteminst.h"
|
||||||
@ -8,28 +12,6 @@
|
|||||||
#include "lua_hate_list.h"
|
#include "lua_hate_list.h"
|
||||||
#include "lua_client.h"
|
#include "lua_client.h"
|
||||||
|
|
||||||
#include "lua.hpp"
|
|
||||||
#include <luabind/luabind.hpp>
|
|
||||||
|
|
||||||
Lua_Mob::Lua_Illusion::Lua_Illusion() {
|
|
||||||
in_race = 0;
|
|
||||||
in_gender = 255;
|
|
||||||
in_texture = 255;
|
|
||||||
in_helmtexture = 255;
|
|
||||||
in_haircolor = 255;
|
|
||||||
in_beardcolor = 255;
|
|
||||||
in_eyecolor1 = 255;
|
|
||||||
in_eyecolor2 = 255;
|
|
||||||
in_hairstyle = 255;
|
|
||||||
in_luclinface = 255;
|
|
||||||
in_beard = 255;
|
|
||||||
in_aa_title = 255;
|
|
||||||
in_drakkin_heritage = 4294967295;
|
|
||||||
in_drakkin_tattoo = 4294967295;
|
|
||||||
in_drakkin_details = 4294967295;
|
|
||||||
in_size = -1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *Lua_Mob::GetName() {
|
const char *Lua_Mob::GetName() {
|
||||||
Lua_Safe_Call_String();
|
Lua_Safe_Call_String();
|
||||||
return self->GetName();
|
return self->GetName();
|
||||||
@ -1363,11 +1345,160 @@ void Lua_Mob::SetGender(int in) {
|
|||||||
self->SendIllusionPacket(self->GetRace(), in);
|
self->SendIllusionPacket(self->GetRace(), in);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lua_Mob::SendIllusionPacket(Lua_Mob::Lua_Illusion ill) {
|
void Lua_Mob::SendIllusionPacket(luabind::object illusion) {
|
||||||
Lua_Safe_Call_Void();
|
Lua_Safe_Call_Void();
|
||||||
self->SendIllusionPacket(ill.in_race, ill.in_gender, ill.in_texture, ill.in_helmtexture, ill.in_haircolor, ill.in_beardcolor,
|
|
||||||
ill.in_eyecolor1, ill.in_eyecolor2, ill.in_hairstyle, ill.in_luclinface, ill.in_beard, ill.in_aa_title,
|
if(luabind::type(illusion) != LUA_TTABLE) {
|
||||||
ill.in_drakkin_heritage, ill.in_drakkin_tattoo, ill.in_drakkin_details, static_cast<float>(ill.in_size));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int race = 0;
|
||||||
|
int gender = 255;
|
||||||
|
int texture = 255;
|
||||||
|
int helmtexture = 255;
|
||||||
|
int haircolor = 255;
|
||||||
|
int beardcolor = 255;
|
||||||
|
int eyecolor1 = 255;
|
||||||
|
int eyecolor2 = 255;
|
||||||
|
int hairstyle = 255;
|
||||||
|
int luclinface = 255;
|
||||||
|
int beard = 255;
|
||||||
|
int aa_title = 255;
|
||||||
|
uint32 drakkin_heritage = 4294967295;
|
||||||
|
uint32 drakkin_tattoo = 4294967295;
|
||||||
|
uint32 drakkin_details = 4294967295;
|
||||||
|
float size = -1.0f;
|
||||||
|
|
||||||
|
auto cur = illusion["race"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
race = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["gender"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
gender = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["texture"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
texture = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["helmtexture"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
helmtexture = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["haircolor"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
haircolor = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["beardcolor"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
beardcolor = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["eyecolor1"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
eyecolor1 = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["eyecolor2"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
eyecolor2 = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["hairstyle"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
hairstyle = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["luclinface"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
luclinface = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["beard"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
beard = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["aa_title"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
aa_title = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["drakkin_heritage"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
drakkin_heritage = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["drakkin_tattoo"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
drakkin_tattoo = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["drakkin_details"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
drakkin_details = luabind::object_cast<int>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = illusion["size"];
|
||||||
|
if(luabind::type(cur) != LUA_TNIL) {
|
||||||
|
try {
|
||||||
|
size = luabind::object_cast<float>(cur);
|
||||||
|
} catch(luabind::cast_failed) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self->SendIllusionPacket(race, gender, texture, helmtexture, haircolor, beardcolor, eyecolor1, eyecolor2, hairstyle, luclinface,
|
||||||
|
beard, aa_title, drakkin_heritage, drakkin_tattoo, drakkin_details, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lua_Mob::QuestReward(Lua_Client c) {
|
void Lua_Mob::QuestReward(Lua_Client c) {
|
||||||
@ -1810,7 +1941,7 @@ luabind::scope lua_register_mob() {
|
|||||||
.def("SetTexture", (void(Lua_Mob::*)(int))&Lua_Mob::SetTexture)
|
.def("SetTexture", (void(Lua_Mob::*)(int))&Lua_Mob::SetTexture)
|
||||||
.def("SetRace", (void(Lua_Mob::*)(int))&Lua_Mob::SetRace)
|
.def("SetRace", (void(Lua_Mob::*)(int))&Lua_Mob::SetRace)
|
||||||
.def("SetGender", (void(Lua_Mob::*)(int))&Lua_Mob::SetGender)
|
.def("SetGender", (void(Lua_Mob::*)(int))&Lua_Mob::SetGender)
|
||||||
.def("SendIllusionPacket", (void(Lua_Mob::*)(Lua_Mob::Lua_Illusion))&Lua_Mob::SendIllusionPacket)
|
.def("SendIllusionPacket", (void(Lua_Mob::*)(luabind::object))&Lua_Mob::SendIllusionPacket)
|
||||||
.def("QuestReward", (void(Lua_Mob::*)(Lua_Client))&Lua_Mob::QuestReward)
|
.def("QuestReward", (void(Lua_Mob::*)(Lua_Client))&Lua_Mob::QuestReward)
|
||||||
.def("QuestReward", (void(Lua_Mob::*)(Lua_Client,uint32))&Lua_Mob::QuestReward)
|
.def("QuestReward", (void(Lua_Mob::*)(Lua_Client,uint32))&Lua_Mob::QuestReward)
|
||||||
.def("QuestReward", (void(Lua_Mob::*)(Lua_Client,uint32,uint32))&Lua_Mob::QuestReward)
|
.def("QuestReward", (void(Lua_Mob::*)(Lua_Client,uint32,uint32))&Lua_Mob::QuestReward)
|
||||||
|
|||||||
@ -11,6 +11,7 @@ class Lua_ItemInst;
|
|||||||
|
|
||||||
namespace luabind {
|
namespace luabind {
|
||||||
struct scope;
|
struct scope;
|
||||||
|
class object;
|
||||||
}
|
}
|
||||||
|
|
||||||
luabind::scope lua_register_mob();
|
luabind::scope lua_register_mob();
|
||||||
@ -19,26 +20,6 @@ class Lua_Mob : public Lua_Entity
|
|||||||
{
|
{
|
||||||
typedef Mob NativeType;
|
typedef Mob NativeType;
|
||||||
public:
|
public:
|
||||||
struct Lua_Illusion {
|
|
||||||
Lua_Illusion();
|
|
||||||
int in_race;
|
|
||||||
int in_gender;
|
|
||||||
int in_texture;
|
|
||||||
int in_helmtexture;
|
|
||||||
int in_haircolor;
|
|
||||||
int in_beardcolor;
|
|
||||||
int in_eyecolor1;
|
|
||||||
int in_eyecolor2;
|
|
||||||
int in_hairstyle;
|
|
||||||
int in_luclinface;
|
|
||||||
int in_beard;
|
|
||||||
int in_aa_title;
|
|
||||||
uint32 in_drakkin_heritage;
|
|
||||||
uint32 in_drakkin_tattoo;
|
|
||||||
uint32 in_drakkin_details;
|
|
||||||
double in_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
Lua_Mob() { }
|
Lua_Mob() { }
|
||||||
Lua_Mob(Mob *d) { SetLuaPtrData(d); }
|
Lua_Mob(Mob *d) { SetLuaPtrData(d); }
|
||||||
virtual ~Lua_Mob() { }
|
virtual ~Lua_Mob() { }
|
||||||
@ -315,7 +296,7 @@ public:
|
|||||||
void SetTexture(int in);
|
void SetTexture(int in);
|
||||||
void SetRace(int in);
|
void SetRace(int in);
|
||||||
void SetGender(int in);
|
void SetGender(int in);
|
||||||
void SendIllusionPacket(Lua_Illusion illusion);
|
void SendIllusionPacket(luabind::object illusion);
|
||||||
void QuestReward(Lua_Client c);
|
void QuestReward(Lua_Client c);
|
||||||
void QuestReward(Lua_Client c, uint32 silver);
|
void QuestReward(Lua_Client c, uint32 silver);
|
||||||
void QuestReward(Lua_Client c, uint32 silver, uint32 gold);
|
void QuestReward(Lua_Client c, uint32 silver, uint32 gold);
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
#ifdef LUA_EQEMU
|
#ifdef LUA_EQEMU
|
||||||
|
|
||||||
#include "masterentity.h"
|
|
||||||
#include "lua_npc.h"
|
|
||||||
|
|
||||||
#include "lua.hpp"
|
#include "lua.hpp"
|
||||||
#include <luabind/luabind.hpp>
|
#include <luabind/luabind.hpp>
|
||||||
|
#include <luabind/object.hpp>
|
||||||
|
|
||||||
|
#include "masterentity.h"
|
||||||
|
#include "lua_npc.h"
|
||||||
|
|
||||||
luabind::scope lua_register_npc() {
|
luabind::scope lua_register_npc() {
|
||||||
return luabind::class_<Lua_NPC, Lua_Mob>("NPC")
|
return luabind::class_<Lua_NPC, Lua_Mob>("NPC")
|
||||||
|
|||||||
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
#include "lua.hpp"
|
#include "lua.hpp"
|
||||||
#include <luabind/luabind.hpp>
|
#include <luabind/luabind.hpp>
|
||||||
|
#include <luabind/object.hpp>
|
||||||
#include <luabind/iterator_policy.hpp>
|
#include <luabind/iterator_policy.hpp>
|
||||||
#include <boost/any.hpp>
|
#include <boost/any.hpp>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -22,9 +24,9 @@
|
|||||||
#include "lua_npc.h"
|
#include "lua_npc.h"
|
||||||
#include "lua_spell.h"
|
#include "lua_spell.h"
|
||||||
#include "lua_general.h"
|
#include "lua_general.h"
|
||||||
#include "zone.h"
|
#include "QGlobals.h"
|
||||||
|
|
||||||
#include "questmgr.h"
|
#include "questmgr.h"
|
||||||
|
#include "zone.h"
|
||||||
#include "lua_parser.h"
|
#include "lua_parser.h"
|
||||||
|
|
||||||
const char *LuaEvents[_LargestEventID] = {
|
const char *LuaEvents[_LargestEventID] = {
|
||||||
@ -202,8 +204,10 @@ int LuaParser::_EventNPC(std::string package_name, QuestEventID evt, NPC* npc, M
|
|||||||
|
|
||||||
auto arg_function = NPCArgumentDispatch[evt];
|
auto arg_function = NPCArgumentDispatch[evt];
|
||||||
arg_function(this, L, npc, init, data, extra_data);
|
arg_function(this, L, npc, init, data, extra_data);
|
||||||
|
ExportZoneVariables();
|
||||||
Client *c = (init && init->IsClient()) ? init->CastToClient() : nullptr;
|
Client *c = (init && init->IsClient()) ? init->CastToClient() : nullptr;
|
||||||
|
ExportQGlobals(npc, c);
|
||||||
|
|
||||||
quest_manager.StartQuest(npc, c, nullptr);
|
quest_manager.StartQuest(npc, c, nullptr);
|
||||||
if(lua_pcall(L, 1, 1, 0)) {
|
if(lua_pcall(L, 1, 1, 0)) {
|
||||||
std::string error = lua_tostring(L, -1);
|
std::string error = lua_tostring(L, -1);
|
||||||
@ -292,6 +296,8 @@ int LuaParser::_EventPlayer(std::string package_name, QuestEventID evt, Client *
|
|||||||
|
|
||||||
auto arg_function = PlayerArgumentDispatch[evt];
|
auto arg_function = PlayerArgumentDispatch[evt];
|
||||||
arg_function(this, L, client, data, extra_data);
|
arg_function(this, L, client, data, extra_data);
|
||||||
|
ExportZoneVariables();
|
||||||
|
ExportQGlobals(nullptr, client);
|
||||||
|
|
||||||
quest_manager.StartQuest(nullptr, client, nullptr);
|
quest_manager.StartQuest(nullptr, client, nullptr);
|
||||||
if(lua_pcall(L, 1, 1, 0)) {
|
if(lua_pcall(L, 1, 1, 0)) {
|
||||||
@ -386,6 +392,8 @@ int LuaParser::_EventItem(std::string package_name, QuestEventID evt, Client *cl
|
|||||||
|
|
||||||
auto arg_function = ItemArgumentDispatch[evt];
|
auto arg_function = ItemArgumentDispatch[evt];
|
||||||
arg_function(this, L, client, item, objid, extra_data);
|
arg_function(this, L, client, item, objid, extra_data);
|
||||||
|
ExportZoneVariables();
|
||||||
|
ExportQGlobals(nullptr, nullptr);
|
||||||
|
|
||||||
quest_manager.StartQuest(nullptr, client, item);
|
quest_manager.StartQuest(nullptr, client, item);
|
||||||
if(lua_pcall(L, 1, 1, 0)) {
|
if(lua_pcall(L, 1, 1, 0)) {
|
||||||
@ -460,6 +468,8 @@ int LuaParser::_EventSpell(std::string package_name, QuestEventID evt, NPC* npc,
|
|||||||
|
|
||||||
auto arg_function = SpellArgumentDispatch[evt];
|
auto arg_function = SpellArgumentDispatch[evt];
|
||||||
arg_function(this, L, npc, client, spell_id, extra_data);
|
arg_function(this, L, npc, client, spell_id, extra_data);
|
||||||
|
ExportZoneVariables();
|
||||||
|
ExportQGlobals(npc, client);
|
||||||
|
|
||||||
quest_manager.StartQuest(npc, client, nullptr);
|
quest_manager.StartQuest(npc, client, nullptr);
|
||||||
if(lua_pcall(L, 1, 1, 0)) {
|
if(lua_pcall(L, 1, 1, 0)) {
|
||||||
@ -520,6 +530,9 @@ int LuaParser::_EventEncounter(std::string package_name, QuestEventID evt, std::
|
|||||||
lua_pushstring(L, encounter_name.c_str());
|
lua_pushstring(L, encounter_name.c_str());
|
||||||
lua_setfield(L, -2, "name");
|
lua_setfield(L, -2, "name");
|
||||||
|
|
||||||
|
ExportZoneVariables();
|
||||||
|
ExportQGlobals(nullptr, nullptr);
|
||||||
|
|
||||||
quest_manager.StartQuest(nullptr, nullptr, nullptr);
|
quest_manager.StartQuest(nullptr, nullptr, nullptr);
|
||||||
if(lua_pcall(L, 1, 1, 0)) {
|
if(lua_pcall(L, 1, 1, 0)) {
|
||||||
std::string error = lua_tostring(L, -1);
|
std::string error = lua_tostring(L, -1);
|
||||||
@ -679,7 +692,7 @@ void LuaParser::ReloadQuests() {
|
|||||||
lua_getglobal(L, "package");
|
lua_getglobal(L, "package");
|
||||||
lua_getfield(L, -1, "path");
|
lua_getfield(L, -1, "path");
|
||||||
std::string module_path = lua_tostring(L,-1);
|
std::string module_path = lua_tostring(L,-1);
|
||||||
module_path += "quests/plugins/?.lua";
|
module_path += "lua_modules/?.lua";
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
lua_pushstring(L, module_path.c_str());
|
lua_pushstring(L, module_path.c_str());
|
||||||
lua_setfield(L, -2, "path");
|
lua_setfield(L, -2, "path");
|
||||||
@ -806,26 +819,7 @@ void LuaParser::MapFunctions(lua_State *L) {
|
|||||||
.property("frenzy", &Lua_HateEntry::GetFrenzy, &Lua_HateEntry::SetFrenzy),
|
.property("frenzy", &Lua_HateEntry::GetFrenzy, &Lua_HateEntry::SetFrenzy),
|
||||||
|
|
||||||
luabind::class_<Lua_HateList>("HateList")
|
luabind::class_<Lua_HateList>("HateList")
|
||||||
.def_readwrite("entries", &Lua_HateList::entries, luabind::return_stl_iterator),
|
.def_readwrite("entries", &Lua_HateList::entries, luabind::return_stl_iterator)
|
||||||
|
|
||||||
luabind::class_<Lua_Mob::Lua_Illusion>("Illusion")
|
|
||||||
.def(luabind::constructor<>())
|
|
||||||
.def_readwrite("race", &Lua_Mob::Lua_Illusion::in_race)
|
|
||||||
.def_readwrite("gender", &Lua_Mob::Lua_Illusion::in_gender)
|
|
||||||
.def_readwrite("texture", &Lua_Mob::Lua_Illusion::in_texture)
|
|
||||||
.def_readwrite("helmtexture", &Lua_Mob::Lua_Illusion::in_helmtexture)
|
|
||||||
.def_readwrite("haircolor", &Lua_Mob::Lua_Illusion::in_haircolor)
|
|
||||||
.def_readwrite("beardcolor", &Lua_Mob::Lua_Illusion::in_beardcolor)
|
|
||||||
.def_readwrite("eyecolor1", &Lua_Mob::Lua_Illusion::in_eyecolor1)
|
|
||||||
.def_readwrite("eyecolor2", &Lua_Mob::Lua_Illusion::in_eyecolor2)
|
|
||||||
.def_readwrite("hairstyle", &Lua_Mob::Lua_Illusion::in_hairstyle)
|
|
||||||
.def_readwrite("luclinface", &Lua_Mob::Lua_Illusion::in_luclinface)
|
|
||||||
.def_readwrite("beard", &Lua_Mob::Lua_Illusion::in_beard)
|
|
||||||
.def_readwrite("aa_title", &Lua_Mob::Lua_Illusion::in_aa_title)
|
|
||||||
.def_readwrite("drakkin_heritage", &Lua_Mob::Lua_Illusion::in_drakkin_heritage)
|
|
||||||
.def_readwrite("drakkin_tattoo", &Lua_Mob::Lua_Illusion::in_drakkin_tattoo)
|
|
||||||
.def_readwrite("drakkin_details", &Lua_Mob::Lua_Illusion::in_drakkin_details)
|
|
||||||
.def_readwrite("size", &Lua_Mob::Lua_Illusion::in_size)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
} catch(std::exception &ex) {
|
} catch(std::exception &ex) {
|
||||||
@ -944,4 +938,109 @@ void LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, u
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LuaParser::ExportQGlobals(NPC *n, Client *c) {
|
||||||
|
lua_createtable(L, 0, 0);
|
||||||
|
|
||||||
|
if(n && !n->GetQglobal()) {
|
||||||
|
lua_setfield(L, -2, "qglobals");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto iter = global_map.begin();
|
||||||
|
while(iter != global_map.end()) {
|
||||||
|
lua_pushstring(L, (*iter).value.c_str());
|
||||||
|
lua_setfield(L, -2, (*iter).name.c_str());
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_setfield(L, -2, "qglobals");
|
||||||
|
}
|
||||||
|
|
||||||
|
void LuaParser::ExportZoneVariables() {
|
||||||
|
if(zone == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_pushinteger(L, zone->GetZoneID());
|
||||||
|
lua_setfield(L, -2, "zone_id");
|
||||||
|
|
||||||
|
lua_pushstring(L, zone->GetLongName());
|
||||||
|
lua_setfield(L, -2, "zone_ln");
|
||||||
|
|
||||||
|
lua_pushstring(L, zone->GetShortName());
|
||||||
|
lua_setfield(L, -2, "zone_sn");
|
||||||
|
|
||||||
|
lua_pushinteger(L, zone->GetInstanceID());
|
||||||
|
lua_setfield(L, -2, "instance_id");
|
||||||
|
|
||||||
|
lua_pushinteger(L, zone->GetInstanceVersion());
|
||||||
|
lua_setfield(L, -2, "instance_version");
|
||||||
|
|
||||||
|
TimeOfDay_Struct eqTime;
|
||||||
|
zone->zone_time.getEQTimeOfDay(time(0), &eqTime);
|
||||||
|
|
||||||
|
lua_pushinteger(L, eqTime.hour - 1);
|
||||||
|
lua_setfield(L, -2, "zone_hour");
|
||||||
|
|
||||||
|
lua_pushinteger(L, eqTime.minute);
|
||||||
|
lua_setfield(L, -2, "zone_minute");
|
||||||
|
|
||||||
|
lua_pushinteger(L, (eqTime.hour - 1) * 100 + eqTime.minute);
|
||||||
|
lua_setfield(L, -2, "zone_time");
|
||||||
|
|
||||||
|
lua_pushinteger(L, zone->zone_weather);
|
||||||
|
lua_setfield(L, -2, "zone_weather");
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -76,6 +76,8 @@ private:
|
|||||||
void ClearStates();
|
void ClearStates();
|
||||||
void MapFunctions(lua_State *L);
|
void MapFunctions(lua_State *L);
|
||||||
void AddError(std::string error);
|
void AddError(std::string error);
|
||||||
|
void ExportQGlobals(NPC *n, Client *c);
|
||||||
|
void ExportZoneVariables();
|
||||||
|
|
||||||
std::map<std::string, std::string> vars_;
|
std::map<std::string, std::string> vars_;
|
||||||
std::map<std::string, bool> loaded_;
|
std::map<std::string, bool> loaded_;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "lua.hpp"
|
#include "lua.hpp"
|
||||||
#include <luabind/luabind.hpp>
|
#include <luabind/luabind.hpp>
|
||||||
#include <boost/any.hpp>
|
#include <luabind/object.hpp>
|
||||||
|
|
||||||
#include "QuestParserCollection.h"
|
#include "QuestParserCollection.h"
|
||||||
#include "QuestInterface.h"
|
#include "QuestInterface.h"
|
||||||
|
|||||||
@ -141,18 +141,16 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
|
|||||||
|
|
||||||
if(IsNPC())
|
if(IsNPC())
|
||||||
{
|
{
|
||||||
if(parse->SpellHasQuestSub(spell_id, "EVENT_SPELL_EFFECT_NPC"))
|
int i = parse->EventSpell(EVENT_SPELL_EFFECT_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0);
|
||||||
{
|
if(i != 0){
|
||||||
parse->EventSpell(EVENT_SPELL_EFFECT_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0);
|
|
||||||
CalcBonuses();
|
CalcBonuses();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(IsClient())
|
else if(IsClient())
|
||||||
{
|
{
|
||||||
if(parse->SpellHasQuestSub(spell_id, "EVENT_SPELL_EFFECT_CLIENT"))
|
int i = parse->EventSpell(EVENT_SPELL_EFFECT_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0);
|
||||||
{
|
if(i != 0){
|
||||||
parse->EventSpell(EVENT_SPELL_EFFECT_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0);
|
|
||||||
CalcBonuses();
|
CalcBonuses();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3068,17 +3066,15 @@ void Mob::DoBuffTic(uint16 spell_id, uint32 ticsremaining, uint8 caster_level, M
|
|||||||
|
|
||||||
if(IsNPC())
|
if(IsNPC())
|
||||||
{
|
{
|
||||||
if(parse->SpellHasQuestSub(spell_id, "EVENT_SPELL_EFFECT_BUFF_TIC_NPC"))
|
int i = parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0);
|
||||||
{
|
if(i != 0) {
|
||||||
parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_NPC, CastToNPC(), nullptr, spell_id, caster ? caster->GetID() : 0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(parse->SpellHasQuestSub(spell_id, "EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT"))
|
int i = parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0);
|
||||||
{
|
if(i != 0) {
|
||||||
parse->EventSpell(EVENT_SPELL_EFFECT_BUFF_TIC_CLIENT, nullptr, CastToClient(), spell_id, caster ? caster->GetID() : 0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3088,7 +3084,7 @@ void Mob::DoBuffTic(uint16 spell_id, uint32 ticsremaining, uint8 caster_level, M
|
|||||||
if(IsClient())
|
if(IsClient())
|
||||||
CastToClient()->CheckAAEffect(aaEffectRampage);
|
CastToClient()->CheckAAEffect(aaEffectRampage);
|
||||||
|
|
||||||
for (int i=0; i < EFFECT_COUNT; i++)
|
for (int i = 0; i < EFFECT_COUNT; i++)
|
||||||
{
|
{
|
||||||
if(IsBlankSpellEffect(spell_id, i))
|
if(IsBlankSpellEffect(spell_id, i))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -587,7 +587,7 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer)
|
|||||||
attuned[i - 3000] = inst->IsInstNoDrop();
|
attuned[i - 3000] = inst->IsInstNoDrop();
|
||||||
|
|
||||||
for(int j = 0; j < 5; j++) {
|
for(int j = 0; j < 5; j++) {
|
||||||
augments[i][j] = inst->GetAugmentItemID(j);
|
augments[i - 3000][j] = inst->GetAugmentItemID(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Item_Struct* item2 = database.GetItem(items[i - 3000]);
|
const Item_Struct* item2 = database.GetItem(items[i - 3000]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user