Merge git://github.com/EQEmu/Server into Development

This commit is contained in:
KayenEQ 2014-11-19 00:19:57 -05:00
commit 6a5b3ef4fe
20 changed files with 1269 additions and 1188 deletions

View File

@ -831,17 +831,18 @@ struct BindStruct {
/*008*/ float y;
/*012*/ float z;
/*016*/ float heading;
/*020*/
/*020*/ uint32 instance_id;
/*024*/
};
struct SuspendedMinion_Struct
{
/*000*/ uint16 SpellID;
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ uint32 Items[_MaterialCount];
/*546*/ char Name[64];
/*000*/ uint16 SpellID;
/*002*/ uint32 HP;
/*006*/ uint32 Mana;
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
/*510*/ uint32 Items[_MaterialCount];
/*546*/ char Name[64];
/*610*/
};
@ -2663,6 +2664,17 @@ struct Translocate_Struct {
/*088*/ uint32 Complete;
};
struct PendingTranslocate_Struct
{
uint32 zone_id;
uint16 instance_id;
float heading;
float x;
float y;
float z;
uint32 spell_id;
};
struct Sacrifice_Struct {
/*000*/ uint32 CasterID;
/*004*/ uint32 TargetID;

View File

@ -222,15 +222,37 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) {
/* if an invalid bind point is specified, use the primary bind */
if (bindnum > 4){ bindnum = 0; }
int is_home = 0;
if (bindnum == 4){ is_home = 1; }
std::string query = StringFormat("SELECT `zone_id` FROM `character_bind` WHERE `id` = %u AND `is_home` = %u LIMIT 1", CharID, is_home);
auto results = database.QueryDatabase(query); int i = 0;
for (auto row = results.begin(); row != results.end(); ++row) {
return atoi(row[0]);
if (bindnum > 4)
{
bindnum = 0;
}
std::string query = StringFormat("SELECT zone_id, instance_id, x, y, z FROM character_bind WHERE id = %u AND is_home = %u LIMIT 1", CharID, bindnum == 4 ? 1 : 0);
auto results = database.QueryDatabase(query);
if(!results.Success() || results.RowCount() == 0) {
return 0;
}
int zone_id, instance_id;
double x, y, z, heading;
for (auto row = results.begin(); row != results.end(); ++row) {
zone_id = atoi(row[0]);
instance_id = atoi(row[1]);
x = atof(row[2]);
y = atof(row[3]);
z = atof(row[4]);
heading = atof(row[5]);
}
query = StringFormat("UPDATE character_data SET zone_id = '%d', zone_instance = '%d', x = '%f', y = '%f', z = '%f', heading = '%f' WHERE id = %u",
zone_id, instance_id, x, y, z, heading, CharID);
results = database.QueryDatabase(query);
if(!results.Success()) {
return 0;
}
return zone_id;
}
bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc)
@ -239,7 +261,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct*
return false;
in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0;
in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = 0;
in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0;
std::string query = StringFormat("SELECT x, y, z, heading, zone_id, bind_id "
"FROM start_zones WHERE player_choice = % i "
@ -267,79 +289,79 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct*
}
case 1:
{
in_pp->zone_id =2; // qeynos2
in_pp->zone_id = 2; // qeynos2
in_pp->binds[0].zoneId = 2; // qeynos2
break;
}
case 2:
{
in_pp->zone_id =29; // halas
in_pp->zone_id = 29; // halas
in_pp->binds[0].zoneId = 30; // everfrost
break;
}
case 3:
{
in_pp->zone_id =19; // rivervale
in_pp->zone_id = 19; // rivervale
in_pp->binds[0].zoneId = 20; // kithicor
break;
}
case 4:
{
in_pp->zone_id =9; // freportw
in_pp->zone_id = 9; // freportw
in_pp->binds[0].zoneId = 9; // freportw
break;
}
case 5:
{
in_pp->zone_id =40; // neriaka
in_pp->zone_id = 40; // neriaka
in_pp->binds[0].zoneId = 25; // nektulos
break;
}
case 6:
{
in_pp->zone_id =52; // gukta
in_pp->zone_id = 52; // gukta
in_pp->binds[0].zoneId = 46; // innothule
break;
}
case 7:
{
in_pp->zone_id =49; // oggok
in_pp->zone_id = 49; // oggok
in_pp->binds[0].zoneId = 47; // feerrott
break;
}
case 8:
{
in_pp->zone_id =60; // kaladima
in_pp->zone_id = 60; // kaladima
in_pp->binds[0].zoneId = 68; // butcher
break;
}
case 9:
{
in_pp->zone_id =54; // gfaydark
in_pp->zone_id = 54; // gfaydark
in_pp->binds[0].zoneId = 54; // gfaydark
break;
}
case 10:
{
in_pp->zone_id =61; // felwithea
in_pp->zone_id = 61; // felwithea
in_pp->binds[0].zoneId = 54; // gfaydark
break;
}
case 11:
{
in_pp->zone_id =55; // akanon
in_pp->zone_id = 55; // akanon
in_pp->binds[0].zoneId = 56; // steamfont
break;
}
case 12:
{
in_pp->zone_id =82; // cabwest
in_pp->zone_id = 82; // cabwest
in_pp->binds[0].zoneId = 78; // fieldofbone
break;
}
case 13:
{
in_pp->zone_id =155; // sharvahl
in_pp->zone_id = 155; // sharvahl
in_pp->binds[0].zoneId = 155; // sharvahl
break;
}
@ -378,7 +400,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru
return false;
in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0;
in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = 0;
in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0;
std::string query = StringFormat("SELECT x, y, z, heading, bind_id FROM start_zones WHERE zone_id = %i "
"AND player_class = %i AND player_deity = %i AND player_race = %i",

View File

@ -1695,7 +1695,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att
dead_timer.Start(5000, true);
m_pp.zone_id = m_pp.binds[0].zoneId;
m_pp.zoneInstance = 0;
m_pp.zoneInstance = m_pp.binds[0].instance_id;
database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id));
Save();
GoToDeath();

View File

@ -398,7 +398,7 @@ Client::~Client() {
if(IsHoveringForRespawn())
{
m_pp.zone_id = m_pp.binds[0].zoneId;
m_pp.zoneInstance = 0;
m_pp.zoneInstance = m_pp.binds[0].instance_id;
x_pos = m_pp.binds[0].x;
y_pos = m_pp.binds[0].y;
z_pos = m_pp.binds[0].z;
@ -543,11 +543,11 @@ bool Client::Save(uint8 iCommitNow) {
m_pp.endurance = cur_end;
/* Save Character Currency */
database.SaveCharacterCurrency(this->CharacterID(), &m_pp);
database.SaveCharacterCurrency(CharacterID(), &m_pp);
/* Save Current Bind Points : Sets Instance to 0 because it is currently not implemented */
database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, 0, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); /* Regular bind */
database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[4].zoneId, 0, m_pp.binds[4].x, m_pp.binds[4].y, m_pp.binds[4].z, 0, 1); /* Home Bind */
/* Save Current Bind Points */
database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); /* Regular bind */
database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[4].zoneId, m_pp.binds[4].instance_id, m_pp.binds[4].x, m_pp.binds[4].y, m_pp.binds[4].z, 0, 1); /* Home Bind */
/* Save Character Buffs */
database.SaveBuffs(this);
@ -3848,7 +3848,8 @@ void Client::Sacrifice(Client *caster)
void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) {
if(!Caster || PendingTranslocate) return;
if(!Caster || PendingTranslocate)
return;
const SPDat_Spell_Struct &Spell = spells[SpellID];
@ -3856,26 +3857,29 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) {
Translocate_Struct *ts = (Translocate_Struct*)outapp->pBuffer;
strcpy(ts->Caster, Caster->GetName());
ts->SpellID = SpellID;
PendingTranslocateData.spell_id = ts->SpellID = SpellID;
if((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) {
ts->ZoneID = m_pp.binds[0].zoneId;
ts->x = m_pp.binds[0].x;
ts->y = m_pp.binds[0].y;
ts->z = m_pp.binds[0].z;
PendingTranslocateData.zone_id = ts->ZoneID = m_pp.binds[0].zoneId;
PendingTranslocateData.instance_id = m_pp.binds[0].instance_id;
PendingTranslocateData.x = ts->x = m_pp.binds[0].x;
PendingTranslocateData.y = ts->y = m_pp.binds[0].y;
PendingTranslocateData.z = ts->z = m_pp.binds[0].z;
PendingTranslocateData.heading = m_pp.binds[0].heading;
}
else {
ts->ZoneID = database.GetZoneID(Spell.teleport_zone);
PendingTranslocateData.instance_id = 0;
ts->y = Spell.base[0];
ts->x = Spell.base[1];
ts->z = Spell.base[2];
PendingTranslocateData.heading = 0.0;
}
ts->unknown008 = 0;
ts->Complete = 0;
PendingTranslocateData = *ts;
PendingTranslocate=true;
PendingTranslocate = true;
TranslocateTime = time(nullptr);
QueuePacket(outapp);
@ -4473,7 +4477,8 @@ void Client::SendRespawnBinds()
BindStruct* b = &m_pp.binds[0];
RespawnOption opt;
opt.name = "Bind Location";
opt.zoneid = b->zoneId;
opt.zone_id = b->zoneId;
opt.instance_id = b->instance_id;
opt.x = b->x;
opt.y = b->y;
opt.z = b->z;
@ -4483,7 +4488,8 @@ void Client::SendRespawnBinds()
//Rez is always added at the end
RespawnOption rez;
rez.name = "Resurrect";
rez.zoneid = zone->GetZoneID();
rez.zone_id = zone->GetZoneID();
rez.instance_id = zone->GetInstanceID();
rez.x = GetX();
rez.y = GetY();
rez.z = GetZ();
@ -4518,7 +4524,7 @@ void Client::SendRespawnBinds()
{
opt = &(*itr);
VARSTRUCT_ENCODE_TYPE(uint32, buffer, count++); //option num (from 0)
VARSTRUCT_ENCODE_TYPE(uint32, buffer, opt->zoneid);
VARSTRUCT_ENCODE_TYPE(uint32, buffer, opt->zone_id);
VARSTRUCT_ENCODE_TYPE(float, buffer, opt->x);
VARSTRUCT_ENCODE_TYPE(float, buffer, opt->y);
VARSTRUCT_ENCODE_TYPE(float, buffer, opt->z);
@ -4891,6 +4897,10 @@ void Client::SetStartZone(uint32 zoneid, float x, float y, float z)
return;
m_pp.binds[4].zoneId = zoneid;
if(zone->GetInstanceID() != 0 && zone->IsInstancePersistent()) {
m_pp.binds[4].instance_id = zone->GetInstanceID();
}
if (x == 0 && y == 0 && z ==0)
database.GetSafePoints(m_pp.binds[4].zoneId, 0, &m_pp.binds[4].x, &m_pp.binds[4].y, &m_pp.binds[4].z);
else {
@ -7937,7 +7947,7 @@ void Client::SendItemScale(ItemInst *inst) {
}
}
void Client::AddRespawnOption(std::string option_name, uint32 zoneid, float x, float y, float z, float heading, bool initial_selection, int8 position)
void Client::AddRespawnOption(std::string option_name, uint32 zoneid, uint16 instance_id, float x, float y, float z, float heading, bool initial_selection, int8 position)
{
//If respawn window is already open, any changes would create an inconsistency with the client
if (IsHoveringForRespawn()) { return; }
@ -7948,7 +7958,8 @@ void Client::AddRespawnOption(std::string option_name, uint32 zoneid, float x, f
//Create respawn option
RespawnOption res_opt;
res_opt.name = option_name;
res_opt.zoneid = zoneid;
res_opt.zone_id = zoneid;
res_opt.instance_id = instance_id;
res_opt.x = x;
res_opt.y = y;
res_opt.z = z;

File diff suppressed because it is too large Load Diff

View File

@ -13725,7 +13725,8 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app)
}
Translocate_Struct *its = (Translocate_Struct*)app->pBuffer;
if (!PendingTranslocate) return;
if (!PendingTranslocate)
return;
if ((RuleI(Spells, TranslocateTimeLimit) > 0) && (time(nullptr) > (TranslocateTime + RuleI(Spells, TranslocateTimeLimit)))) {
Message(13, "You did not accept the Translocate within the required time limit.");
@ -13735,7 +13736,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app)
if (its->Complete == 1) {
int SpellID = PendingTranslocateData.SpellID;
int SpellID = PendingTranslocateData.spell_id;
int i = parse->EventSpell(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE, nullptr, this, SpellID, 0);
if (i == 0)
@ -13745,20 +13746,19 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app)
// to the bind coords it has from the PlayerProfile, but with the X and Y reversed. I suspect they are
// reversed in the pp, and since spells like Gate are handled serverside, this has not mattered before.
if (((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) &&
zone->GetZoneID() == PendingTranslocateData.ZoneID)
(zone->GetZoneID() == PendingTranslocateData.zone_id &&
zone->GetInstanceID() == PendingTranslocateData.instance_id))
{
PendingTranslocate = false;
GoToBind();
return;
}
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Translocate, sizeof(Translocate_Struct));
Translocate_Struct *ots = (Translocate_Struct*)outapp->pBuffer;
memcpy(ots, &PendingTranslocateData, sizeof(Translocate_Struct));
//Was sending the packet back to initiate client zone...
//but that could be abusable, so lets go through proper channels
MovePC(ots->ZoneID, 0, ots->x, ots->y, ots->z, GetHeading(), 0, ZoneSolicited);
////Was sending the packet back to initiate client zone...
////but that could be abusable, so lets go through proper channels
MovePC(PendingTranslocateData.zone_id, PendingTranslocateData.instance_id,
PendingTranslocateData.x, PendingTranslocateData.y,
PendingTranslocateData.z, PendingTranslocateData.heading, 0, ZoneSolicited);
}
}

View File

@ -147,11 +147,11 @@ bool Client::Process() {
if(mana_timer.Check())
SendManaUpdatePacket();
if(dead && dead_timer.Check())
{
database.MoveCharacterToZone(GetName(),database.GetZoneName(m_pp.binds[0].zoneId));
if(dead && dead_timer.Check()) {
database.MoveCharacterToZone(GetName(), database.GetZoneName(m_pp.binds[0].zoneId));
m_pp.zone_id = m_pp.binds[0].zoneId;
m_pp.zoneInstance = 0;
m_pp.zoneInstance = m_pp.binds[0].instance_id;
m_pp.x = m_pp.binds[0].x;
m_pp.y = m_pp.binds[0].y;
m_pp.z = m_pp.binds[0].z;
@ -2120,7 +2120,8 @@ void Client::HandleRespawnFromHover(uint32 Option)
BindStruct* b = &m_pp.binds[0];
default_to_bind = new RespawnOption;
default_to_bind->name = "Bind Location";
default_to_bind->zoneid = b->zoneId;
default_to_bind->zone_id = b->zoneId;
default_to_bind->instance_id = b->instance_id;
default_to_bind->x = b->x;
default_to_bind->y = b->y;
default_to_bind->z = b->z;
@ -2129,7 +2130,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
is_rez = false;
}
if (chosen->zoneid == zone->GetZoneID()) //If they should respawn in the current zone...
if (chosen->zone_id == zone->GetZoneID() && chosen->instance_id == zone->GetInstanceID()) //If they should respawn in the current zone...
{
if (is_rez)
{
@ -2185,6 +2186,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer;
gmg->bind_zone_id = zone->GetZoneID();
gmg->bind_instance_id = chosen->instance_id;
gmg->x = chosen->x;
gmg->y = chosen->y;
gmg->z = chosen->z;
@ -2230,13 +2232,13 @@ void Client::HandleRespawnFromHover(uint32 Option)
if(r)
r->MemberZoned(this);
m_pp.zone_id = chosen->zoneid;
m_pp.zoneInstance = 0;
database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(chosen->zoneid));
m_pp.zone_id = chosen->zone_id;
m_pp.zoneInstance = chosen->instance_id;
database.MoveCharacterToZone(CharacterID(), database.GetZoneName(chosen->zone_id));
Save();
MovePC(chosen->zoneid,chosen->x,chosen->y,chosen->z,chosen->heading,1);
MovePC(chosen->zone_id, chosen->instance_id, chosen->x, chosen->y, chosen->z, chosen->heading, 1);
}
safe_delete(default_to_bind);

View File

@ -150,31 +150,19 @@ int command_init(void) {
if
(
command_add("resetaa","- Resets a Player's AA in their profile and refunds spent AA's to unspent, disconnects player.",200,command_resetaa) ||
command_add("qtest","- QueryServ testing command.",255,command_qtest) ||
command_add("bind","- Sets your targets bind spot to their current location",200,command_bind) ||
command_add("sendop","[opcode] - LE's Private test command, leave it alone",200,command_sendop) ||
command_add("optest","- solar's private test command",255,command_optest) ||
command_add("setstat","- Sets the stats to a specific value.",255,command_setstat) ||
command_add("incstat","- Increases or Decreases a client's stats permanently.",200,command_incstat) ||
command_add("help","[search term] - List available commands and their description, specify partial command as argument to search",0,command_help) ||
command_add("version","- Display current version of EQEmu server",0,command_version) ||
command_add("setfaction","[faction number] - Sets targeted NPC's faction in the database",170,command_setfaction) ||
command_add("serversidename","- Prints target's server side name",0,command_serversidename) ||
command_add("testspawn","[memloc] [value] - spawns a NPC for you only, with the specified values set in the spawn struct",200,command_testspawn) ||
command_add("testspawnkill","- Sends an OP_Death packet for spawn made with #testspawn",200,command_testspawnkill) ||
command_add("wc","[wear slot] [material] - Sends an OP_WearChange for your target",200,command_wc) ||
command_add("numauths","- TODO: describe this command",200,command_numauths) ||
command_add("setanim","[animnum] - Set target's appearance to animnum",200,command_setanim) ||
command_add("connectworldserver","- Make zone attempt to connect to worldserver",200,command_connectworldserver) ||
command_add("connectworld",nullptr,0,command_connectworldserver) ||
command_add("serverinfo","- Get OS info about server host",200,command_serverinfo) ||
command_add("crashtest","- Crash the zoneserver",200,command_crashtest) ||
command_add("getvariable","[varname] - Get the value of a variable from the database",200,command_getvariable) ||
command_add("chat","[channel num] [message] - Send a channel message to all zones",200,command_chat) ||
command_add("showpetspell","[spellid/searchstring] - search pet summoning spells",200,command_showpetspell) ||
#ifdef IPC
command_add("ipc","- Toggle an NPC's interactive flag",200,command_ipc) ||
#endif
command_add("npcloot","[show/money/add/remove] [itemid/all/money: pp gp sp cp] - Manipulate the loot an NPC is carrying",80,command_npcloot) ||
command_add("log","- Search character event log",80,command_log) ||
command_add("gm","- Turn player target's or your GM flag on or off",80,command_gm) ||
@ -182,7 +170,6 @@ int command_init(void) {
command_add("zone","[zonename] [x] [y] [z] - Go to specified zone (coords optional)",50,command_zone) ||
command_add("zoneinstance","[instanceid] [x] [y] [z] - Go to specified instance zone (coords optional)",50,command_zone_instance) ||
command_add("peqzone","[zonename] - Go to specified zone, if you have > 75% health",0,command_peqzone) ||
command_add("tgczone",nullptr,0,command_peqzone) ||
command_add("showbuffs","- List buffs active on your target or you if no target",50,command_showbuffs) ||
command_add("movechar","[charname] [zonename] - Move charname to zonename",50,command_movechar) ||
command_add("viewpetition","[petition number] - View a petition",20,command_viewpetition) ||
@ -192,14 +179,12 @@ int command_init(void) {
command_add("date","[yyyy] [mm] [dd] [HH] [MM] - Set EQ time",90,command_date) ||
command_add("time","[HH] [MM] - Set EQ time",90,command_time) ||
command_add("timezone","[HH] [MM] - Set timezone. Minutes are optional",90,command_timezone) ||
command_add("synctod","- Send a time of day update to every client in zone",90,command_synctod) ||
command_add("invulnerable","[on/off] - Turn player target's or your invulnerable flag on or off",80,command_invul) ||
command_add("invul",nullptr,0,command_invul) ||
command_add("hideme","[on/off] - Hide yourself from spawn lists.",80,command_hideme) ||
command_add("gmhideme",nullptr,0,command_hideme) ||
command_add("emote","['name'/'world'/'zone'] [type] [message] - Send an emote message",80,command_emote) ||
command_add("fov","- Check wether you're behind or in your target's field of view",80,command_fov) ||
command_add("manastat","- Report your or your target's cur/max mana",80,command_manastat) ||
command_add("npcstats","- Show stats about target NPC",80,command_npcstats) ||
command_add("zclip","[min] [max] - modifies and resends zhdr packet",80,command_zclip) ||
command_add("npccast","[targetname/entityid] [spellid] - Causes NPC target to cast spellid on targetname/entityid",80,command_npccast) ||
@ -210,7 +195,6 @@ int command_init(void) {
command_add("permagender","[gendernum] - Change your or your player target's gender (zone to take effect)",80,command_permagender) ||
command_add("weather","[0/1/2/3] (Off/Rain/Snow/Manual) - Change the weather",80,command_weather) ||
command_add("zheader","[zonename] - Load zheader for zonename from the database",80,command_zheader) ||
command_add("zhdr",nullptr,0,command_zheader) ||
command_add("zsky","[skytype] - Change zone sky type",80,command_zsky) ||
command_add("zcolor","[red] [green] [blue] - Change sky color",80,command_zcolor) ||
command_add("zuwcoords","[z coord] - Set underworld coord",80,command_zuwcoords) ||
@ -218,7 +202,6 @@ int command_init(void) {
command_add("zunderworld","[zcoord] - Sets the underworld using zcoord",80,command_zunderworld) ||
command_add("spon","- Sends OP_MemorizeSpell",80,command_spon) ||
command_add("spoff","- Sends OP_ManaChange",80,command_spoff) ||
command_add("itemtest","- merth's test function",250,command_itemtest) ||
command_add("gassign","[id] - Assign targetted NPC to predefined wandering grid id",100,command_gassign) ||
command_add("ai","[factionid/spellslist/con/guard/roambox/stop/start] - Modify AI on NPC target",100,command_ai) ||
command_add("showspellslist","Shows spell list of targeted NPC",100,command_showspellslist) ||
@ -254,7 +237,7 @@ int command_init(void) {
command_add("spawn","[name] [race] [level] [material] [hp] [gender] [class] [priweapon] [secweapon] [merchantid] - Spawn an NPC",10,command_spawn) ||
command_add("texture","[texture] [helmtexture] - Change your or your target's appearance, use 255 to show equipment",10,command_texture) ||
command_add("npctypespawn","[npctypeid] [factionid] - Spawn an NPC from the db",10,command_npctypespawn) ||
command_add("dbspawn",nullptr,0,command_npctypespawn) ||
command_add("dbspawn",nullptr,10,command_npctypespawn) ||
command_add("heal","- Completely heal your target",10,command_heal) ||
command_add("appearance","[type] [value] - Send an appearance packet for you or your target",150,command_appearance) ||
command_add("nukeitem","[itemid] - Remove itemid from your player target's inventory",150,command_nukeitem) ||
@ -262,14 +245,12 @@ int command_init(void) {
command_add("interrogateinv","- use [help] argument for available options",0,command_interrogateinv) ||
command_add("findnpctype","[search criteria] - Search database NPC types",100,command_findnpctype) ||
command_add("findzone","[search criteria] - Search database zones",100,command_findzone) ||
command_add("fz",nullptr,100, command_findzone) ||
command_add("viewnpctype","[npctype id] - Show info about an npctype",100,command_viewnpctype) ||
command_add("reloadstatic","- Reload Static Zone Data",150,command_reloadstatic) ||
command_add("reloadquest"," - Clear quest cache (any argument causes it to also stop all timers)",150,command_reloadqst) ||
command_add("reloadqst"," - Clear quest cache (any argument causes it to also stop all timers)",150,command_reloadqst) ||
command_add("reloadworld",nullptr,255,command_reloadworld) ||
command_add("reloadlevelmods",nullptr,255,command_reloadlevelmods) ||
command_add("rq",nullptr,0,command_reloadqst) ||
command_add("reloadzonepoints","- Reload zone points from database",150,command_reloadzps) ||
command_add("reloadzps",nullptr,0,command_reloadzps) ||
command_add("zoneshutdown","[shortname] - Shut down a zone server",150,command_zoneshutdown) ||
@ -334,7 +315,6 @@ int command_init(void) {
command_add("manaburn","- Use AA Wizard class skill manaburn on target",10,command_manaburn) ||
command_add("doanim","[animnum] [type] - Send an EmoteAnim for you or your target",50,command_doanim) ||
command_add("randomfeatures","- Temporarily randomizes the Facial Features of your target",80,command_randomfeatures) ||
command_add("rf",nullptr,80,command_randomfeatures) ||
command_add("face","- Change the face of your target",80,command_face) ||
command_add("helm","- Change the helm of your target",80,command_helm) ||
command_add("hair","- Change the hair style of your target",80,command_hair) ||
@ -349,7 +329,6 @@ int command_init(void) {
command_add("scribespell", "[spellid] - Scribe specified spell in your target's spell book.", 180, command_scribespell) ||
command_add("unscribespell", "[spellid] - Unscribe specified spell from your target's spell book.", 180, command_unscribespell) ||
command_add("interrupt","[message id] [color] - Interrupt your casting. Arguments are optional.",50,command_interrupt) ||
command_add("d1","[type] [spell] [damage] - Send an OP_Action packet with the specified values",200,command_d1) ||
command_add("summonitem","[itemid] [charges] - Summon an item onto your cursor. Charges are optional.",200,command_summonitem) ||
command_add("si",nullptr,200,command_summonitem) ||
command_add("giveitem","[itemid] [charges] - Summon an item onto your target's cursor. Charges are optional.",200,command_giveitem) ||
@ -709,77 +688,6 @@ void command_resetaa(Client* c,const Seperator *sep){
c->Message(0,"Usage: Target a client and use #resetaa to reset the AA data in their Profile.");
}
void command_sendop(Client *c,const Seperator *sep){
int RezSpell = 0;
if(sep->arg[1][0]) {
RezSpell = atoi(sep->arg[1]);
}
EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct));
Resurrect_Struct *rs = (Resurrect_Struct*)outapp->pBuffer;
strcpy(rs->your_name, c->GetName());
strcpy(rs->rezzer_name, "A Cleric01");
rs->spellid = RezSpell;
DumpPacket(outapp);
c->QueuePacket(outapp);
safe_delete(outapp);
return;
}
void command_optest(Client *c, const Seperator *sep)
{
if(sep->IsNumber(1))
{
switch(atoi(sep->arg[1]))
{
case 1:
{
EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureFinish, sizeof(AdventureFinish_Struct));
AdventureFinish_Struct *af = (AdventureFinish_Struct*)outapp->pBuffer;
af->win_lose = 1;
af->points = 125;
c->FastQueuePacket(&outapp);
break;
}
case 2:
{
EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureData, sizeof(AdventureRequestResponse_Struct));
AdventureRequestResponse_Struct *arr = (AdventureRequestResponse_Struct*)outapp->pBuffer;
if(sep->IsHexNumber(2))
arr->unknown000 = hextoi(sep->arg[2]);
else
arr->unknown000 = 0xBFC40100;
arr->risk = 1;
arr->showcompass = 1;
strcpy(arr->text, "This is some text for an adventure packet!\0");
arr->timeleft = 60*60;
//arr->timetoenter = 30*60;
if(sep->IsHexNumber(3))
arr->unknown2080=hextoi(sep->arg[3]);
else
arr->unknown2080=0x0A;
arr->x = c->GetY();
arr->y = c->GetX();
arr->z = c->GetZ();
c->FastQueuePacket(&outapp);
break;
}
case 3:
{
c->SendMarqueeMessage(15, 250, 0, 500, 5000, "Some msg");
break;
}
default:
{
break;
}
}
}
}
void command_help(Client *c, const Seperator *sep)
{
int commands_shown=0;
@ -838,50 +746,6 @@ void command_serversidename(Client *c, const Seperator *sep)
c->Message(0, "Error: no target");
}
void command_testspawnkill(Client *c, const Seperator *sep)
{
/* EQApplicationPacket* outapp = new EQApplicationPacket(OP_Death, sizeof(Death_Struct));
Death_Struct* d = (Death_Struct*)outapp->pBuffer;
d->corpseid = 1000;
// d->unknown011 = 0x05;
d->spawn_id = 1000;
d->killer_id = c->GetID();
d->damage = 1;
d->spell_id = 0;
d->type = BASH;
d->bindzoneid = 0;
c->FastQueuePacket(&outapp);*/
}
void command_testspawn(Client *c, const Seperator *sep)
{
if (sep->IsNumber(1)) {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewSpawn, sizeof(NewSpawn_Struct));
NewSpawn_Struct* ns = (NewSpawn_Struct*)outapp->pBuffer;
c->FillSpawnStruct(ns, c);
strcpy(ns->spawn.name, "Test");
ns->spawn.spawnId = 1000;
ns->spawn.NPC = 1;
if (sep->IsHexNumber(2)) {
if (strlen(sep->arg[2]) >= 3) // 0x00, 1 byte
*(&((uint8*) &ns->spawn)[atoi(sep->arg[1])]) = hextoi(sep->arg[2]);
else if (strlen(sep->arg[2]) >= 5) // 0x0000, 2 bytes
*((uint16*) &(((uint8*) &ns->spawn)[atoi(sep->arg[1])])) = hextoi(sep->arg[2]);
else if (strlen(sep->arg[2]) >= 9) // 0x0000, 2 bytes
*((uint32*) &(((uint8*) &ns->spawn)[atoi(sep->arg[1])])) = hextoi(sep->arg[2]);
else
c->Message(0, "Error: unexpected hex string length");
}
else {
strcpy((char*) (&((uint8*) &ns->spawn)[atoi(sep->arg[1])]), sep->argplus[2]);
}
EncryptSpawnPacket(outapp);
c->FastQueuePacket(&outapp);
}
else
c->Message(0, "Usage: #testspawn [memloc] [value] - spawns a NPC for you only, with the specified values set in the spawn struct");
}
void command_wc(Client *c, const Seperator *sep)
{
if(sep->argnum < 2)
@ -927,12 +791,6 @@ void command_wc(Client *c, const Seperator *sep)
}
}
void command_numauths(Client *c, const Seperator *sep)
{
c->Message(0, "NumAuths: %i", zone->CountAuth());
c->Message(0, "Your WID: %i", c->GetWID());
}
void command_setanim(Client *c, const Seperator *sep)
{
if (c->GetTarget() && sep->IsNumber(1)) {
@ -972,13 +830,6 @@ char buffer[255];
#endif
}
void command_crashtest(Client *c, const Seperator *sep)
{
c->Message(0,"Alright, now we get an GPF ;) ");
char* gpf=0;
memcpy(gpf, "Ready to crash", 30);
}
void command_getvariable(Client *c, const Seperator *sep)
{
char tmp[512];
@ -997,71 +848,6 @@ void command_chat(Client *c, const Seperator *sep)
c->Message(0, "Error: World server disconnected");
}
void command_showpetspell(Client *c, const Seperator *sep)
{
if (sep->arg[1][0] == 0)
c->Message(0, "Usage: #ShowPetSpells [spellid | searchstring]");
else if (SPDAT_RECORDS <= 0)
c->Message(0, "Spells not loaded");
else if (Seperator::IsNumber(sep->argplus[1]))
{
int spellid = atoi(sep->argplus[1]);
if (spellid <= 0 || spellid >= SPDAT_RECORDS)
c->Message(0, "Error: Number out of range");
else
c->Message(0, " %i: %s, %s", spellid, spells[spellid].teleport_zone, spells[spellid].name);
}
else
{
int count=0;
char sName[64];
char sCriteria[65];
strn0cpy(sCriteria, sep->argplus[1], 64);
strupr(sCriteria);
for (int i = 0; i < SPDAT_RECORDS; i++)
{
if (spells[i].name[0] != 0 && (spells[i].effectid[0] == SE_SummonPet || spells[i].effectid[0] == SE_NecPet))
{
strcpy(sName, spells[i].teleport_zone);
strupr(sName);
char* pdest = strstr(sName, sCriteria);
if ((pdest != nullptr) && (count <=20))
{
c->Message(0, " %i: %s, %s", i, spells[i].teleport_zone, spells[i].name);
count++;
}
else if (count > 20)
break;
}
}
if (count > 20)
c->Message(0, "20 spells found... max reached.");
else
c->Message(0, "%i spells found.", count);
}
}
#ifdef IPC
void command_ipc(Client *c, const Seperator *sep)
{
if (c->GetTarget() && c->GetTarget()->IsNPC())
{
if (c->GetTarget()->CastToNPC()->IsInteractive())
{
c->GetTarget()->CastToNPC()->interactive = false;
c->Message(0, "Disabling IPC");
}
else
{
c->GetTarget()->CastToNPC()->interactive = true;
c->Message(0, "Enabling IPC");
}
}
else
c->Message(0, "Error: You must target an NPC");
}
#endif /* IPC */
void command_npcloot(Client *c, const Seperator *sep)
{
if (c->GetTarget() == 0)
@ -1641,16 +1427,6 @@ void command_timezone(Client *c, const Seperator *sep)
}
}
void command_synctod(Client *c, const Seperator *sep)
{
c->Message(13, "Updating Time/Date for all clients in zone...");
EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));
TimeOfDay_Struct* tod = (TimeOfDay_Struct*)outapp->pBuffer;
zone->zone_time.getEQTimeOfDay(time(0), tod);
entity_list.QueueClients(c, outapp);
safe_delete(outapp);
}
void command_invul(Client *c, const Seperator *sep)
{
bool state=atobool(sep->arg[1]);
@ -1714,15 +1490,6 @@ void command_fov(Client *c, const Seperator *sep)
c->Message(0, "I Need a target!");
}
void command_manastat(Client *c, const Seperator *sep)
{
Mob *target=c->GetTarget()?c->GetTarget():c;
c->Message(0, "Mana for %s:", target->GetName());
c->Message(0, " Current Mana: %d",target->GetMana());
c->Message(0, " Max Mana: %d",target->GetMaxMana());
}
void command_npcstats(Client *c, const Seperator *sep)
{
if (c->GetTarget() == 0)
@ -5915,19 +5682,6 @@ void command_interrupt(Client *c, const Seperator *sep)
c->InterruptSpell(ci_message, ci_color);
}
void command_d1(Client *c, const Seperator *sep)
{
EQApplicationPacket app(OP_Action, sizeof(Action_Struct));
Action_Struct* a = (Action_Struct*)app.pBuffer;
a->target = c->GetTarget()->GetID();
a->source = c->GetID();
a->type = atoi(sep->arg[1]);
a->spell = atoi(sep->arg[2]);
a->sequence = atoi(sep->arg[3]);
app.priority = 1;
entity_list.QueueCloseClients(c, &app);
}
void command_summonitem(Client *c, const Seperator *sep)
{
if (!sep->IsNumber(1))
@ -10871,28 +10625,6 @@ void command_picklock(Client *c, const Seperator *sep)
}
}
void command_qtest(Client *c, const Seperator *sep)
{
if(c && sep->arg[1][0])
{
if(c->GetTarget())
{
ServerPacket* pack = new ServerPacket(ServerOP_Speech, sizeof(Server_Speech_Struct)+strlen(sep->arg[1])+1);
Server_Speech_Struct* sem = (Server_Speech_Struct*) pack->pBuffer;
strcpy(sem->message, sep->arg[1]);
sem->minstatus = c->Admin();
sem->type = 1;
strncpy(sem->to,c->GetTarget()->GetCleanName(), 64);
strncpy(sem->to,c->GetCleanName(), 64);
sem->guilddbid = c->GuildID();
worldserver.SendPacket(pack);
safe_delete(pack);
}
}
}
void command_mysql(Client *c, const Seperator *sep)
{
if(!sep->arg[1][0] || !sep->arg[2][0]) {

View File

@ -235,19 +235,24 @@ void Lua_Client::SetBindPoint(int to_zone) {
self->SetBindPoint(to_zone);
}
void Lua_Client::SetBindPoint(int to_zone, float new_x) {
void Lua_Client::SetBindPoint(int to_zone, int to_instance) {
Lua_Safe_Call_Void();
self->SetBindPoint(to_zone, new_x);
self->SetBindPoint(to_zone, to_instance);
}
void Lua_Client::SetBindPoint(int to_zone, float new_x, float new_y) {
void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x) {
Lua_Safe_Call_Void();
self->SetBindPoint(to_zone, new_x, new_y);
self->SetBindPoint(to_zone, to_instance, new_x);
}
void Lua_Client::SetBindPoint(int to_zone, float new_x, float new_y, float new_z) {
void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y) {
Lua_Safe_Call_Void();
self->SetBindPoint(to_zone, new_x, new_y, new_z);
self->SetBindPoint(to_zone, to_instance, new_x, new_y);
}
void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z) {
Lua_Safe_Call_Void();
self->SetBindPoint(to_zone, to_instance, new_x, new_y, new_z);
}
float Lua_Client::GetBindX() {
@ -1297,9 +1302,10 @@ luabind::scope lua_register_client() {
.def("SetEXP", (void(Lua_Client::*)(uint32,uint32,bool))&Lua_Client::SetEXP)
.def("SetBindPoint", (void(Lua_Client::*)(void))&Lua_Client::SetBindPoint)
.def("SetBindPoint", (void(Lua_Client::*)(int))&Lua_Client::SetBindPoint)
.def("SetBindPoint", (void(Lua_Client::*)(int,float))&Lua_Client::SetBindPoint)
.def("SetBindPoint", (void(Lua_Client::*)(int,float,float))&Lua_Client::SetBindPoint)
.def("SetBindPoint", (void(Lua_Client::*)(int,float,float,float))&Lua_Client::SetBindPoint)
.def("SetBindPoint", (void(Lua_Client::*)(int,int))&Lua_Client::SetBindPoint)
.def("SetBindPoint", (void(Lua_Client::*)(int,int,float))&Lua_Client::SetBindPoint)
.def("SetBindPoint", (void(Lua_Client::*)(int,int,float,float))&Lua_Client::SetBindPoint)
.def("SetBindPoint", (void(Lua_Client::*)(int,int,float,float, float))&Lua_Client::SetBindPoint)
.def("GetBindX", (float(Lua_Client::*)(void))&Lua_Client::GetBindX)
.def("GetBindX", (float(Lua_Client::*)(int))&Lua_Client::GetBindX)
.def("GetBindY", (float(Lua_Client::*)(void))&Lua_Client::GetBindY)

View File

@ -73,9 +73,10 @@ public:
void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp);
void SetBindPoint();
void SetBindPoint(int to_zone);
void SetBindPoint(int to_zone, float new_x);
void SetBindPoint(int to_zone, float new_x, float new_y);
void SetBindPoint(int to_zone, float new_x, float new_y, float new_z);
void SetBindPoint(int to_zone, int to_instance);
void SetBindPoint(int to_zone, int to_instance, float new_x);
void SetBindPoint(int to_zone, int to_instance, float new_x, float new_y);
void SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z);
float GetBindX();
float GetBindX(int index);
float GetBindY();

View File

@ -1249,6 +1249,152 @@ double lua_clock() {
return static_cast<double>(t) / 1000.0;
}
#define LuaCreateNPCParse(name, c_type, default_value) do { \
cur = table[#name]; \
if(luabind::type(cur) != LUA_TNIL) { \
try { \
npc_type->name = luabind::object_cast<c_type>(cur); \
} \
catch(luabind::cast_failed) { \
npc_type->size = default_value; \
} \
} \
else { \
npc_type->size = default_value; \
} \
} while(0)
#define LuaCreateNPCParseString(name, str_length, default_value) do { \
cur = table[#name]; \
if(luabind::type(cur) != LUA_TNIL) { \
try { \
std::string tmp = luabind::object_cast<std::string>(cur); \
strncpy(npc_type->name, tmp.c_str(), str_length); \
} \
catch(luabind::cast_failed) { \
strncpy(npc_type->name, default_value, str_length); \
} \
} \
else { \
strncpy(npc_type->name, default_value, str_length); \
} \
} while(0)
void lua_create_npc(luabind::adl::object table, float x, float y, float z, float heading) {
if(luabind::type(table) != LUA_TTABLE) {
return;
}
NPCType* npc_type = new NPCType;
memset(npc_type, 0, sizeof(NPCType));
luabind::adl::index_proxy<luabind::adl::object> cur = table["name"];
LuaCreateNPCParseString(name, 64, "_");
LuaCreateNPCParseString(lastname, 64, "");
LuaCreateNPCParse(cur_hp, int32, 30);
LuaCreateNPCParse(max_hp, int32, 30);
LuaCreateNPCParse(size, float, 6.0f);
LuaCreateNPCParse(runspeed, float, 1.25f);
LuaCreateNPCParse(gender, uint8, 0);
LuaCreateNPCParse(race, uint16, 1);
LuaCreateNPCParse(class_, uint8, WARRIOR);
LuaCreateNPCParse(bodytype, uint8, 0);
LuaCreateNPCParse(deity, uint8, 0);
LuaCreateNPCParse(level, uint8, 1);
LuaCreateNPCParse(npc_id, uint32, 1);
LuaCreateNPCParse(texture, uint8, 0);
LuaCreateNPCParse(helmtexture, uint8, 0);
LuaCreateNPCParse(loottable_id, uint32, 0);
LuaCreateNPCParse(npc_spells_id, uint32, 0);
LuaCreateNPCParse(npc_spells_effects_id, uint32, 0);
LuaCreateNPCParse(npc_faction_id, int32, 0);
LuaCreateNPCParse(merchanttype, uint32, 0);
LuaCreateNPCParse(alt_currency_type, uint32, 0);
LuaCreateNPCParse(adventure_template, uint32, 0);
LuaCreateNPCParse(trap_template, uint32, 0);
LuaCreateNPCParse(light, uint8, 0);
LuaCreateNPCParse(AC, uint32, 0);
LuaCreateNPCParse(Mana, uint32, 0);
LuaCreateNPCParse(ATK, uint32, 0);
LuaCreateNPCParse(STR, uint32, 75);
LuaCreateNPCParse(STA, uint32, 75);
LuaCreateNPCParse(DEX, uint32, 75);
LuaCreateNPCParse(AGI, uint32, 75);
LuaCreateNPCParse(INT, uint32, 75);
LuaCreateNPCParse(WIS, uint32, 75);
LuaCreateNPCParse(CHA, uint32, 75);
LuaCreateNPCParse(MR, int32, 25);
LuaCreateNPCParse(FR, int32, 25);
LuaCreateNPCParse(CR, int32, 25);
LuaCreateNPCParse(PR, int32, 25);
LuaCreateNPCParse(DR, int32, 25);
LuaCreateNPCParse(Corrup, int32, 25);
LuaCreateNPCParse(PhR, int32, 0);
LuaCreateNPCParse(haircolor, uint8, 0);
LuaCreateNPCParse(beardcolor, uint8, 0);
LuaCreateNPCParse(eyecolor1, uint8, 0);
LuaCreateNPCParse(eyecolor2, uint8, 0);
LuaCreateNPCParse(hairstyle, uint8, 0);
LuaCreateNPCParse(luclinface, uint8, 0);
LuaCreateNPCParse(beard, uint8, 0);
LuaCreateNPCParse(drakkin_heritage, uint32, 0);
LuaCreateNPCParse(drakkin_tattoo, uint32, 0);
LuaCreateNPCParse(drakkin_details, uint32, 0);
LuaCreateNPCParse(armor_tint[0], uint32, 0);
LuaCreateNPCParse(armor_tint[1], uint32, 0);
LuaCreateNPCParse(armor_tint[2], uint32, 0);
LuaCreateNPCParse(armor_tint[3], uint32, 0);
LuaCreateNPCParse(armor_tint[4], uint32, 0);
LuaCreateNPCParse(armor_tint[5], uint32, 0);
LuaCreateNPCParse(armor_tint[6], uint32, 0);
LuaCreateNPCParse(armor_tint[7], uint32, 0);
LuaCreateNPCParse(armor_tint[8], uint32, 0);
LuaCreateNPCParse(min_dmg, uint32, 2);
LuaCreateNPCParse(max_dmg, uint32, 4);
LuaCreateNPCParse(attack_count, int16, 0);
LuaCreateNPCParseString(special_abilities, 512, "");
LuaCreateNPCParse(d_meele_texture1, uint16, 0);
LuaCreateNPCParse(d_meele_texture2, uint16, 0);
LuaCreateNPCParseString(ammo_idfile, 32, "");
LuaCreateNPCParse(prim_melee_type, uint8, 0);
LuaCreateNPCParse(sec_melee_type, uint8, 0);
LuaCreateNPCParse(ranged_type, uint8, 0);
LuaCreateNPCParse(hp_regen, int32, 1);
LuaCreateNPCParse(mana_regen, int32, 1);
LuaCreateNPCParse(aggroradius, int32, 0);
LuaCreateNPCParse(assistradius, int32, 0);
LuaCreateNPCParse(see_invis, uint8, 0);
LuaCreateNPCParse(see_invis_undead, bool, false);
LuaCreateNPCParse(see_hide, bool, false);
LuaCreateNPCParse(see_improved_hide, bool, false);
LuaCreateNPCParse(qglobal, bool, false);
LuaCreateNPCParse(npc_aggro, bool, false);
LuaCreateNPCParse(spawn_limit, uint8, false);
LuaCreateNPCParse(mount_color, uint8, false);
LuaCreateNPCParse(attack_speed, float, 0);
LuaCreateNPCParse(attack_delay, uint8, 30);
LuaCreateNPCParse(accuracy_rating, int, 0);
LuaCreateNPCParse(avoidance_rating, int, 0);
LuaCreateNPCParse(findable, bool, false);
LuaCreateNPCParse(trackable, bool, false);
LuaCreateNPCParse(slow_mitigation, int16, 0);
LuaCreateNPCParse(maxlevel, uint8, 0);
LuaCreateNPCParse(scalerate, uint32, 0);
LuaCreateNPCParse(private_corpse, bool, false);
LuaCreateNPCParse(unique_spawn_by_name, bool, false);
LuaCreateNPCParse(underwater, bool, false);
LuaCreateNPCParse(emoteid, uint32, 0);
LuaCreateNPCParse(spellscale, float, 0);
LuaCreateNPCParse(healscale, float, 0);
LuaCreateNPCParse(no_target_hotkey, bool, false);
LuaCreateNPCParse(raid_target, bool, false);
LuaCreateNPCParse(probability, uint8, 0);
NPC* npc = new NPC(npc_type, nullptr, x, y, z, heading, FlyMode3);
npc->GiveNPCTypeData(npc_type);
entity_list.AddNPC(npc);
}
luabind::scope lua_register_general() {
return luabind::namespace_("eq")
[
@ -1435,7 +1581,8 @@ luabind::scope lua_register_general() {
luabind::def("enable_recipe", &lua_enable_recipe),
luabind::def("disable_recipe", &lua_disable_recipe),
luabind::def("clear_npctype_cache", &lua_clear_npctype_cache),
luabind::def("clock", &lua_clock)
luabind::def("clock", &lua_clock),
luabind::def("create_npc", &lua_create_npc)
];
}

View File

@ -4,17 +4,17 @@
#include "zonedb.h"
#include "npc.h"
#define MAXMERCS 1
#define MERC_DEBUG 0
#define TANK 1
#define HEALER 2
#define MELEEDPS 9
#define CASTERDPS 12
#define MAXMERCS 1
#define MERC_DEBUG 0
#define TANK 1
#define HEALER 2
#define MELEEDPS 9
#define CASTERDPS 12
#define NO_MERC_ID 0
#define MERC_STATE_NORMAL 5
#define NO_MERC_ID 0
#define MERC_STATE_NORMAL 5
#define MERC_STATE_SUSPENDED 1
#define NOT_SUSPENDED_TIME 0
#define NOT_SUSPENDED_TIME 0
const int MercAISpellRange = 100; // TODO: Write a method that calcs what the merc's spell range is based on spell, equipment, AA, whatever and replace this
@ -31,19 +31,19 @@ enum MercStanceType {
};
struct MercSpell {
uint16 spellid; // <= 0 = no spell
uint32 type; // 0 = never, must be one (and only one) of the defined values
int16 stance; // 0 = all, + = only this stance, - = all except this stance
int16 slot;
uint16 proc_chance;
uint32 time_cancast; // when we can cast this spell next
uint16 spellid; // <= 0 = no spell
uint32 type; // 0 = never, must be one (and only one) of the defined values
int16 stance; // 0 = all, + = only this stance, - = all except this stance
int16 slot;
uint16 proc_chance;
uint32 time_cancast; // when we can cast this spell next
};
struct MercTimer {
uint16 timerid; // EndurTimerIndex
uint8 timertype; // 1 = spell, 2 = disc
uint16 spellid; // <= 0 = no spell
uint32 time_cancast; // when we can cast this spell next
uint16 timerid; // EndurTimerIndex
uint8 timertype; // 1 = spell, 2 = disc
uint16 spellid; // <= 0 = no spell
uint32 time_cancast; // when we can cast this spell next
};
class Merc : public NPC {
@ -170,16 +170,16 @@ public:
inline const uint8 GetClientVersion() const { return _OwnerClientVersion; }
virtual void SetTarget(Mob* mob);
bool HasSkill(SkillUseTypes skill_id) const;
bool CanHaveSkill(SkillUseTypes skill_id) const;
uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const;
inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); }
bool HasSkill(SkillUseTypes skill_id) const;
bool CanHaveSkill(SkillUseTypes skill_id) const;
uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const;
inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); }
virtual void DoClassAttacks(Mob *target);
void CheckHateList();
bool CheckTaunt();
bool CheckAETaunt();
bool CheckConfidence();
bool TryHide();
void CheckHateList();
bool CheckTaunt();
bool CheckAETaunt();
bool CheckConfidence();
bool TryHide();
// stat functions
virtual void CalcBonuses();
@ -189,56 +189,56 @@ public:
inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; }
int32 GetRawACNoShield(int &shield_ac) const;
inline virtual int32 GetSTR() const { return STR; }
inline virtual int32 GetSTA() const { return STA; }
inline virtual int32 GetDEX() const { return DEX; }
inline virtual int32 GetAGI() const { return AGI; }
inline virtual int32 GetINT() const { return INT; }
inline virtual int32 GetWIS() const { return WIS; }
inline virtual int32 GetCHA() const { return CHA; }
inline virtual int32 GetMR() const { return MR; }
inline virtual int32 GetFR() const { return FR; }
inline virtual int32 GetDR() const { return DR; }
inline virtual int32 GetPR() const { return PR; }
inline virtual int32 GetCR() const { return CR; }
inline virtual int32 GetCorrup() const { return Corrup; }
inline virtual int32 GetSTR() const { return STR; }
inline virtual int32 GetSTA() const { return STA; }
inline virtual int32 GetDEX() const { return DEX; }
inline virtual int32 GetAGI() const { return AGI; }
inline virtual int32 GetINT() const { return INT; }
inline virtual int32 GetWIS() const { return WIS; }
inline virtual int32 GetCHA() const { return CHA; }
inline virtual int32 GetMR() const { return MR; }
inline virtual int32 GetFR() const { return FR; }
inline virtual int32 GetDR() const { return DR; }
inline virtual int32 GetPR() const { return PR; }
inline virtual int32 GetCR() const { return CR; }
inline virtual int32 GetCorrup() const { return Corrup; }
inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; }
inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; }
inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; }
inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; }
inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; }
inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; }
inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; }
inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; }
inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; }
inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; }
inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; }
inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; }
inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; }
inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; }
inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; }
inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; }
inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; }
inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; }
inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; }
inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; }
inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; }
inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; }
inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; }
inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; }
inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; }
inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; }
// Mod2
inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; }
inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; }
inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; }
inline virtual int32 GetStunResist() const { return itembonuses.StunResist; }
inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; }
inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; }
inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; }
inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; }
inline virtual int32 GetDS() const { return itembonuses.DamageShield; }
inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; }
inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; }
inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; }
inline virtual int32 GetStunResist() const { return itembonuses.StunResist; }
inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; }
inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; }
inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; }
inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; }
inline virtual int32 GetDS() const { return itembonuses.DamageShield; }
// Mod3
inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; }
inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; }
inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; }
inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; }
inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; }
inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; }
inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; }
inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; }
inline virtual int32 GetSingMod() const { return itembonuses.singingMod; }
inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; }
inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; }
inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; }
inline virtual int32 GetWindMod() const { return itembonuses.windMod; }
inline virtual int32 GetSingMod() const { return itembonuses.singingMod; }
inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; }
inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; }
inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; }
inline virtual int32 GetWindMod() const { return itembonuses.windMod; }
inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; }
inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; }
// "SET" Class Methods
void SetMercData (uint32 templateID );
@ -279,53 +279,53 @@ protected:
std::map<uint32,MercTimer> timers;
uint16 skills[HIGHEST_SKILL+1];
uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs
uint16 d_meele_texture1; //this is an item Material value
uint16 d_meele_texture2; //this is an item Material value (offhand)
uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation
uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation
uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs
uint16 d_meele_texture1; //this is an item Material value
uint16 d_meele_texture2; //this is an item Material value (offhand)
uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation
uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation
private:
int32 CalcAC();
int32 GetACMit();
int32 GetACAvoid();
int32 acmod();
int32 CalcATK();
//int CalcHaste();
int32 CalcAC();
int32 GetACMit();
int32 GetACAvoid();
int32 acmod();
int32 CalcATK();
//int CalcHaste();
int32 CalcSTR();
int32 CalcSTA();
int32 CalcDEX();
int32 CalcAGI();
int32 CalcINT();
int32 CalcWIS();
int32 CalcCHA();
int32 CalcSTR();
int32 CalcSTA();
int32 CalcDEX();
int32 CalcAGI();
int32 CalcINT();
int32 CalcWIS();
int32 CalcCHA();
int32 CalcMR();
int32 CalcFR();
int32 CalcDR();
int32 CalcPR();
int32 CalcCR();
int32 CalcCorrup();
int32 CalcMaxHP();
int32 CalcBaseHP();
int32 GetClassHPFactor();
int32 CalcHPRegen();
int32 CalcHPRegenCap();
int32 CalcMaxMana();
int32 CalcBaseMana();
int32 CalcManaRegen();
int32 CalcBaseManaRegen();
int32 CalcManaRegenCap();
void CalcMaxEndurance(); //This calculates the maximum endurance we can have
int32 CalcBaseEndurance(); //Calculates Base End
int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call
int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen()
int32 CalcEnduranceRegenCap();
void SetEndurance(int32 newEnd); //This sets the current endurance to the new value
void DoEnduranceUpkeep(); //does the endurance upkeep
void CalcRestState();
int32 CalcMR();
int32 CalcFR();
int32 CalcDR();
int32 CalcPR();
int32 CalcCR();
int32 CalcCorrup();
int32 CalcMaxHP();
int32 CalcBaseHP();
int32 GetClassHPFactor();
int32 CalcHPRegen();
int32 CalcHPRegenCap();
int32 CalcMaxMana();
int32 CalcBaseMana();
int32 CalcManaRegen();
int32 CalcBaseManaRegen();
int32 CalcManaRegenCap();
void CalcMaxEndurance(); //This calculates the maximum endurance we can have
int32 CalcBaseEndurance(); //Calculates Base End
int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call
int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen()
int32 CalcEnduranceRegenCap();
void SetEndurance(int32 newEnd); //This sets the current endurance to the new value
void DoEnduranceUpkeep(); //does the endurance upkeep
void CalcRestState();
int GroupLeadershipAAHealthEnhancement();
int GroupLeadershipAAManaEnhancement();
@ -351,8 +351,8 @@ private:
uint32 _baseWIS;
uint32 _baseCHA;
uint32 _baseATK;
uint32 _baseRace; // Necessary to preserve the race otherwise mercs get their race updated in the db when they get an illusion.
uint8 _baseGender; // Merc gender. Necessary to preserve the original value otherwise it can be changed by illusions.
uint32 _baseRace; // Necessary to preserve the race otherwise mercs get their race updated in the db when they get an illusion.
uint8 _baseGender; // Merc gender. Necessary to preserve the original value otherwise it can be changed by illusions.
uint32 _baseMR;
uint32 _baseCR;
uint32 _baseDR;

View File

@ -1924,6 +1924,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
else if(id == "PhR") { PhR = atoi(val.c_str()); return; }
else if(id == "runspeed") { runspeed = (float)atof(val.c_str()); CalcBonuses(); return; }
else if(id == "special_attacks") { NPCSpecialAttacks(val.c_str(), 0, 1); return; }
else if(id == "special_abilities") { ProcessSpecialAbilities(val.c_str()); return; }
else if(id == "attack_speed") { attack_speed = (float)atof(val.c_str()); CalcBonuses(); return; }
else if(id == "atk") { ATK = atoi(val.c_str()); return; }
else if(id == "accuracy") { accuracy_rating = atoi(val.c_str()); return; }

View File

@ -1023,11 +1023,12 @@ XS(XS_Client_SetBindPoint); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_SetBindPoint)
{
dXSARGS;
if (items < 1 || items > 5)
Perl_croak(aTHX_ "Usage: Client::SetBindPoint(THIS, to_zone= -1, new_x= 0.0f, new_y= 0.0f, new_z= 0.0f)");
if (items < 1 || items > 6)
Perl_croak(aTHX_ "Usage: Client::SetBindPoint(THIS, to_zone= -1, to_instance = 0, new_x= 0.0f, new_y= 0.0f, new_z= 0.0f)");
{
Client * THIS;
int to_zone;
int to_instance;
float new_x;
float new_y;
float new_z;
@ -1047,25 +1048,31 @@ XS(XS_Client_SetBindPoint)
to_zone = (int)SvIV(ST(1));
}
if (items < 3)
new_x = 0.0f;
if(items < 3)
to_instance = 0;
else {
new_x = (float)SvNV(ST(2));
to_instance = (int)SvIV(ST(2));
}
if (items < 4)
new_y = 0.0f;
new_x = 0.0f;
else {
new_y = (float)SvNV(ST(3));
new_x = (float)SvNV(ST(3));
}
if (items < 5)
new_z = 0.0f;
new_y = 0.0f;
else {
new_z = (float)SvNV(ST(4));
new_y = (float)SvNV(ST(4));
}
THIS->SetBindPoint(to_zone, new_x, new_y, new_z);
if (items < 6)
new_z = 0.0f;
else {
new_z = (float)SvNV(ST(5));
}
THIS->SetBindPoint(to_zone, to_instance, new_x, new_y, new_z);
}
XSRETURN_EMPTY;
}
@ -6155,7 +6162,7 @@ XS(boot_Client)
newXSproto(strcpy(buf, "SetDeity"), XS_Client_SetDeity, file, "$$");
newXSproto(strcpy(buf, "AddEXP"), XS_Client_AddEXP, file, "$$;$$");
newXSproto(strcpy(buf, "SetEXP"), XS_Client_SetEXP, file, "$$$;$");
newXSproto(strcpy(buf, "SetBindPoint"), XS_Client_SetBindPoint, file, "$;$$$$");
newXSproto(strcpy(buf, "SetBindPoint"), XS_Client_SetBindPoint, file, "$;$$$$$");
newXSproto(strcpy(buf, "GetBindX"), XS_Client_GetBindX, file, "$$");
newXSproto(strcpy(buf, "GetBindY"), XS_Client_GetBindY, file, "$$");
newXSproto(strcpy(buf, "GetBindZ"), XS_Client_GetBindZ, file, "$$");

View File

@ -8187,6 +8187,158 @@ XS(XS_Mob_GetSpellStat)
XSRETURN(1);
}
XS(XS_Mob_GetSpecialAbility); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_GetSpecialAbility)
{
dXSARGS;
if(items != 2)
Perl_croak(aTHX_ "Usage: Mob::GetSpecialAbility(THIS, special_ability)");
{
int RETVAL;
Mob* THIS;
int ability = SvIV(ST(1));
dXSTARG;
if(sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob *, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetSpecialAbility(ability);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
XS(XS_Mob_GetSpecialAbilityParam); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_GetSpecialAbilityParam)
{
dXSARGS;
if(items != 3)
Perl_croak(aTHX_ "Usage: Mob::GetSpecialAbilityParam(THIS, special_ability, param)");
{
int RETVAL;
Mob* THIS;
int ability = SvIV(ST(1));
int param = SvIV(ST(2));
dXSTARG;
if(sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob *, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetSpecialAbilityParam(ability, param);
XSprePUSH; PUSHi((IV)RETVAL);
}
XSRETURN(1);
}
XS(XS_Mob_SetSpecialAbility); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_SetSpecialAbility)
{
dXSARGS;
if(items != 3)
Perl_croak(aTHX_ "Usage: Mob::SetSpecialAbility(THIS, ability, value)");
{
Mob* THIS;
int ability = SvIV(ST(1));
int value = SvIV(ST(2));
if(sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob *, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetSpecialAbility(ability, value);
}
XSRETURN_EMPTY;
}
XS(XS_Mob_SetSpecialAbilityParam); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_SetSpecialAbilityParam)
{
dXSARGS;
if(items != 4)
Perl_croak(aTHX_ "Usage: Mob::SetSpecialAbilityParam(THIS, ability, param, value)");
{
Mob* THIS;
int ability = SvIV(ST(1));
int param = SvIV(ST(2));
int value = SvIV(ST(3));
if(sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob *, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetSpecialAbilityParam(ability, param, value);
}
XSRETURN_EMPTY;
}
XS(XS_Mob_ClearSpecialAbilities); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_ClearSpecialAbilities)
{
dXSARGS;
if(items != 1)
Perl_croak(aTHX_ "Usage: Mob::ClearSpecialAbilities(THIS)");
{
Mob* THIS;
if(sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob *, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->ClearSpecialAbilities();
}
XSRETURN_EMPTY;
}
XS(XS_Mob_ProcessSpecialAbilities); /* prototype to pass -Wmissing-prototypes */
XS(XS_Mob_ProcessSpecialAbilities)
{
dXSARGS;
if(items != 2)
Perl_croak(aTHX_ "Usage: Mob::ProcessSpecialAbilities(THIS, str)");
{
Mob* THIS;
const char *str = (const char*)SvPV_nolen(ST(1));
if(sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob *, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->ProcessSpecialAbilities(str);
}
XSRETURN_EMPTY;
}
#ifdef __cplusplus
extern "C"
@ -8485,11 +8637,16 @@ XS(boot_Mob)
newXSproto(strcpy(buf, "DoArcheryAttackDmg"), XS_Mob_DoArcheryAttackDmg, file, "$$$$$$$");
newXSproto(strcpy(buf, "DoThrowingAttackDmg"), XS_Mob_DoThrowingAttackDmg, file, "$$$$$$$");
newXSproto(strcpy(buf, "SetDisableMelee"), XS_Mob_SetDisableMelee, file, "$$");
newXSproto(strcpy(buf, "IsMeleeDisabled"), XS_Mob_IsMeleeDisabled, file, "$$");
newXSproto(strcpy(buf, "IsMeleeDisabled"), XS_Mob_IsMeleeDisabled, file, "$");
newXSproto(strcpy(buf, "SetFlurryChance"), XS_Mob_SetFlurryChance, file, "$$");
newXSproto(strcpy(buf, "GetFlurryChance"), XS_Mob_GetFlurryChance, file, "$");
newXSproto(strcpy(buf, "GetSpellStat"), XS_Mob_GetSpellStat, file, "$$$$");
newXSproto(strcpy(buf, "GetSpecialAbility"), XS_Mob_GetSpecialAbility, file, "$$");
newXSproto(strcpy(buf, "GetSpecialAbilityParam"), XS_Mob_GetSpecialAbilityParam, file, "$$$");
newXSproto(strcpy(buf, "SetSpecialAbility"), XS_Mob_SetSpecialAbility, file, "$$$");
newXSproto(strcpy(buf, "SetSpecialAbilityParam"), XS_Mob_SetSpecialAbilityParam, file, "$$$$");
newXSproto(strcpy(buf, "ClearSpecialAbilities"), XS_Mob_ClearSpecialAbilities, file, "$");
newXSproto(strcpy(buf, "ProcessSpecialAbilities"), XS_Mob_ProcessSpecialAbilities, file, "$$");
XSRETURN_YES;
}

View File

@ -172,5 +172,5 @@ void QGlobalCache::LoadBy(const std::string &query)
return;
for (auto row = results.begin(); row != results.end(); ++row)
AddGlobal(0, QGlobal(std::string(row[0]), atoi(row[1]), atoi(row[2]), atoi(row[3]), row[4], row[5]? atoi(row[5]): 0xFFFFFFFF));
AddGlobal(0, QGlobal(row[0], atoi(row[1]), atoi(row[2]), atoi(row[3]), row[4], row[5] ? atoi(row[5]) : 0xFFFFFFFF));
}

View File

@ -755,6 +755,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
zoneid = in_zoneid;
instanceid = in_instanceid;
instanceversion = database.GetInstanceVersion(instanceid);
pers_instance = false;
zonemap = nullptr;
watermap = nullptr;
pathing = nullptr;
@ -824,11 +825,12 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
if(!is_perma)
{
if(rem < 150) //give some leeway to people who are zoning in 2.5 minutes to finish zoning in and get ported out
rem = 150;
rem = 150;
Instance_Timer = new Timer(rem * 1000);
}
else
{
pers_instance = true;
Instance_Timer = nullptr;
}
}

View File

@ -104,6 +104,7 @@ public:
inline const uint32 GetZoneID() const { return zoneid; }
inline const uint32 GetInstanceID() const { return instanceid; }
inline const uint16 GetInstanceVersion() const { return instanceversion; }
inline const bool IsInstancePersistent() const { return pers_instance; }
inline const uint8 GetZoneType() const { return zone_type; }
inline Timer* GetInstanceTimer() { return Instance_Timer; }
@ -274,6 +275,7 @@ private:
uint32 zoneid;
uint32 instanceid;
uint16 instanceversion;
bool pers_instance;
char* short_name;
char file_name[16];
char* long_name;

View File

@ -1197,21 +1197,21 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str
i = 0;
/* Is home bind */
if (atoi(row[6]) == 1){
pp->binds[4].zoneId = atoi(row[i]); i++;
i++; /* Instance ID can go here eventually */
pp->binds[4].x = atoi(row[i]); i++;
pp->binds[4].y = atoi(row[i]); i++;
pp->binds[4].z = atoi(row[i]); i++;
pp->binds[4].heading = atoi(row[i]); i++;
pp->binds[4].zoneId = atoi(row[i++]);
pp->binds[4].instance_id = atoi(row[i++]);
pp->binds[4].x = atoi(row[i++]);
pp->binds[4].y = atoi(row[i++]);
pp->binds[4].z = atoi(row[i++]);
pp->binds[4].heading = atoi(row[i++]);
}
/* Is regular bind point */
else{
pp->binds[0].zoneId = atoi(row[i]); i++;
i++; /* Instance ID can go here eventually */
pp->binds[0].x = atoi(row[i]); i++;
pp->binds[0].y = atoi(row[i]); i++;
pp->binds[0].z = atoi(row[i]); i++;
pp->binds[0].heading = atoi(row[i]); i++;
pp->binds[0].zoneId = atoi(row[i++]);
pp->binds[0].instance_id = atoi(row[i++]);
pp->binds[0].x = atoi(row[i++]);
pp->binds[0].y = atoi(row[i++]);
pp->binds[0].z = atoi(row[i++]);
pp->binds[0].heading = atoi(row[i++]);
}
}
return true;
@ -1224,12 +1224,18 @@ bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, ui
}
bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home){
if (zone_id <= 0){ return false; }
if (zone_id <= 0) {
return false;
}
/* Save Home Bind Point */
std::string query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i)", character_id, zone_id, instance_id, x, y, z, heading, is_home);
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home);
auto results = QueryDatabase(query); if (!results.RowsAffected()){ std::cout << "ERROR Bind Home Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; }
auto results = QueryDatabase(query);
if (!results.RowsAffected()) {
LogFile->write(EQEMuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str());
}
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterBindPoint", query);
return true;
}
@ -3234,7 +3240,6 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in
bool ZoneDatabase::LoadFactionData()
{
std::string query = "SELECT MAX(id) FROM faction_list";
auto results = QueryDatabase(query);
if (!results.Success()) {
@ -3265,7 +3270,6 @@ bool ZoneDatabase::LoadFactionData()
strn0cpy(faction_array[index]->name, row[1], 50);
faction_array[index]->base = atoi(row[2]);
query = StringFormat("SELECT `mod`, `mod_name` FROM `faction_list_mod` WHERE faction_id = %u", index);
auto modResults = QueryDatabase(query);
if (!modResults.Success())
@ -3273,8 +3277,9 @@ bool ZoneDatabase::LoadFactionData()
for (auto modRow = modResults.begin(); modRow != modResults.end(); ++modRow)
faction_array[index]->mods[modRow[1]] = atoi(modRow[0]);
}
return true;
}
bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::list<struct NPCFaction*> *faction_list, int32* primary_faction) {

View File

@ -71,9 +71,11 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
break;
case GateToBindPoint:
target_zone_id = m_pp.binds[0].zoneId;
target_instance_id = m_pp.binds[0].instance_id;
break;
case ZoneToBindPoint:
target_zone_id = m_pp.binds[0].zoneId;
target_instance_id = m_pp.binds[0].instance_id;
break;
case ZoneSolicited: //we told the client to zone somewhere, so we know where they are going.
target_zone_id = zonesummon_id;
@ -717,20 +719,22 @@ void NPC::Gate() {
Mob::Gate();
}
void Client::SetBindPoint(int to_zone, float new_x, float new_y, float new_z) {
void Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z) {
if (to_zone == -1) {
m_pp.binds[0].zoneId = zone->GetZoneID();
m_pp.binds[0].instance_id = (zone->GetInstanceID() != 0 && zone->IsInstancePersistent()) ? zone->GetInstanceID() : 0;
m_pp.binds[0].x = x_pos;
m_pp.binds[0].y = y_pos;
m_pp.binds[0].z = z_pos;
}
else {
m_pp.binds[0].zoneId = to_zone;
m_pp.binds[0].instance_id = to_instance;
m_pp.binds[0].x = new_x;
m_pp.binds[0].y = new_y;
m_pp.binds[0].z = new_z;
}
database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, 0, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0);
database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0);
}
void Client::GoToBind(uint8 bindnum) {
@ -741,13 +745,13 @@ void Client::GoToBind(uint8 bindnum) {
// move the client, which will zone them if needed.
// ignore restrictions on the zone request..?
if(bindnum == 0)
MovePC(m_pp.binds[0].zoneId, 0.0f, 0.0f, 0.0f, 0.0f, 1, GateToBindPoint);
MovePC(m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, 0.0f, 0.0f, 0.0f, 0.0f, 1, GateToBindPoint);
else
MovePC(m_pp.binds[bindnum].zoneId, m_pp.binds[bindnum].x, m_pp.binds[bindnum].y, m_pp.binds[bindnum].z, m_pp.binds[bindnum].heading, 1);
MovePC(m_pp.binds[bindnum].zoneId, m_pp.binds[bindnum].instance_id, m_pp.binds[bindnum].x, m_pp.binds[bindnum].y, m_pp.binds[bindnum].z, m_pp.binds[bindnum].heading, 1);
}
void Client::GoToDeath() {
MovePC(m_pp.binds[0].zoneId, 0.0f, 0.0f, 0.0f, 0.0f, 1, ZoneToBindPoint);
MovePC(m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, 0.0f, 0.0f, 0.0f, 0.0f, 1, ZoneToBindPoint);
}
void Client::SetZoneFlag(uint32 zone_id) {