Merge from master

This commit is contained in:
KimLS
2015-02-25 19:39:48 -08:00
27 changed files with 197 additions and 77 deletions
+2 -2
View File
@@ -4132,7 +4132,7 @@ void Bot::Spawn(Client* botCharacterOwner, std::string* errorMessage) {
this->SendPosition();
// there is something askew with spawn struct appearance fields...
// I re-enabled this until I can sort it out -U
// I re-enabled this until I can sort it out
uint32 itemID = 0;
uint8 materialFromSlot = 0xFF;
for(int i = EmuConstants::EQUIPMENT_BEGIN; i <= EmuConstants::EQUIPMENT_END; ++i) {
@@ -10823,7 +10823,7 @@ void Bot::ProcessBotInspectionRequest(Bot* inspectedBot, Client* client) {
// Modded to display power source items (will only show up on SoF+ client inspect windows though.)
// I don't think bots are currently coded to use them..but, you'll have to use '#bot inventory list'
// to see them on a Titanium client when/if they are activated. -U
// to see them on a Titanium client when/if they are activated.
for(int16 L = EmuConstants::EQUIPMENT_BEGIN; L <= MainWaist; L++) {
inst = inspectedBot->GetBotItem(L);
+2
View File
@@ -6220,6 +6220,8 @@ void Client::DragCorpses()
!corpse->CastToCorpse()->Summon(this, false, false)) {
Message_StringID(MT_DefaultText, CORPSEDRAG_STOP);
It = DraggedCorpses.erase(It);
if (It == DraggedCorpses.end())
break;
}
}
}
+1 -1
View File
@@ -3899,7 +3899,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
}
else if (m_inv.SupportsClickCasting(castspell->inventoryslot) || (castspell->slot == POTION_BELT_SPELL_SLOT) || (castspell->slot == TARGET_RING_SPELL_SLOT)) // sanity check
{
// packet field types will be reviewed as packet transistions occur -U
// packet field types will be reviewed as packet transistions occur
const ItemInst* inst = m_inv[castspell->inventoryslot]; //slot values are int16, need to check packet on this field
//bool cancast = true;
if (inst && inst->IsType(ItemClassCommon))
+1 -1
View File
@@ -340,7 +340,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
database.TransactionBegin();
// I have an untested process that avoids this snarl up when all possessions inventory is removed..but this isn't broke -U
// I have an untested process that avoids this snarl up when all possessions inventory is removed..but this isn't broke
if (!removed_list.empty()) {
std::stringstream ss("");
ss << "DELETE FROM inventory WHERE charid=" << client->CharacterID();
+1 -1
View File
@@ -756,7 +756,7 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_
} else { // check to stop casting beneficial ae buffs (to wit: bard songs) on enemies...
// This does not check faction for beneficial AE buffs..only agro and attackable.
// I've tested for spells that I can find without problem, but a faction-based
// check may still be needed. Any changes here should also reflect in BardAEPulse() -U
// check may still be needed. Any changes here should also reflect in BardAEPulse()
if (caster->IsAttackAllowed(curmob, true))
continue;
if (caster->CheckAggro(curmob))
+2 -2
View File
@@ -1308,7 +1308,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
case EVENT_SCALE_CALC:
case EVENT_ITEM_ENTER_ZONE: {
// need a valid ItemInst pointer check here..unsure how to cancel this process -U
// need a valid ItemInst pointer check here..unsure how to cancel this process
ExportVar(package_name.c_str(), "itemid", objid);
ExportVar(package_name.c_str(), "itemname", iteminst->GetItem()->Name);
break;
@@ -1316,7 +1316,7 @@ void PerlembParser::ExportEventVariables(std::string &package_name, QuestEventID
case EVENT_ITEM_CLICK_CAST:
case EVENT_ITEM_CLICK: {
// need a valid ItemInst pointer check here..unsure how to cancel this process -U
// need a valid ItemInst pointer check here..unsure how to cancel this process
ExportVar(package_name.c_str(), "itemid", objid);
ExportVar(package_name.c_str(), "itemname", iteminst->GetItem()->Name);
ExportVar(package_name.c_str(), "slotid", extradata);
+5 -6
View File
@@ -1067,12 +1067,12 @@ bool MakeItemLink(char* &ret_link, const ItemData *item, uint32 aug0, uint32 aug
// Currently, enabling them causes misalignments in what the client expects. I haven't looked
// into it further to determine the cause..but, the function is setup to accept the parameters.
// Note: some links appear with '00000' in front of the name..so, it's likely we need to send
// some additional information when certain parameters are true -U
// some additional information when certain parameters are true
//switch (GetClientVersion()) {
switch (0) {
case EQClientRoF2:
// This operator contains 14 parameter masks..but, only 13 parameter values.
// Even so, the client link appears ok... Need to figure out the discrepancy -U
// Even so, the client link appears ok... Need to figure out the discrepancy
MakeAnyLenString(&ret_link, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%1X" "%04X" "%1X" "%05X" "%08X",
0,
item->ID,
@@ -1793,7 +1793,7 @@ void Client::SwapItemResync(MoveItemOld_Struct* move_slots) {
// with any luck..this won't be needed in the future
// resync the 'from' and 'to' slots on an as-needed basis
// Not as effective as the full process, but less intrusive to gameplay -U
// Not as effective as the full process, but less intrusive to gameplay
Log.Out(Logs::Detail, Logs::Inventory, "Inventory desyncronization. (charname: %s, source: %i, destination: %i)", GetName(), move_slots->from_slot, move_slots->to_slot);
Message(15, "Inventory Desyncronization detected: Resending slot data...");
@@ -1803,7 +1803,6 @@ void Client::SwapItemResync(MoveItemOld_Struct* move_slots) {
// This prevents the client from crashing when closing any 'phantom' bags -U
const ItemData* token_struct = database.GetItem(22292); // 'Copper Coin'
ItemInst* token_inst = database.CreateItemOld(token_struct, 1);
SendItemPacket(resync_slot, token_inst, ItemPacketTrade);
if(m_inv[resync_slot]) { SendItemPacket(resync_slot, m_inv[resync_slot], ItemPacketTrade); }
@@ -2297,7 +2296,7 @@ void Client::RemoveDuplicateLore(bool client_update)
safe_delete(inst);
}
// Shared Bank and Shared Bank Containers are not checked due to their allowing duplicate lore items -U
// Shared Bank and Shared Bank Containers are not checked due to their allowing duplicate lore items
if (!m_inv.CursorEmpty()) {
std::list<ItemInst*> local_1;
@@ -2367,7 +2366,7 @@ void Client::MoveSlotNotAllowed(bool client_update)
safe_delete(inst);
}
// No need to check inventory, cursor, bank or shared bank since they allow max item size and containers -U
// No need to check inventory, cursor, bank or shared bank since they allow max item size and containers
// Code can be added to check item size vs. container size, but it is left to attrition for now.
}
+23
View File
@@ -2394,6 +2394,29 @@ void NPC::DoQuestPause(Mob *other) {
}
void NPC::ChangeLastName(const char* in_lastname)
{
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GMLastName, sizeof(GMLastName_Struct));
GMLastName_Struct* gmn = (GMLastName_Struct*)outapp->pBuffer;
strcpy(gmn->name, GetName());
strcpy(gmn->gmname, GetName());
strcpy(gmn->lastname, in_lastname);
gmn->unknown[0]=1;
gmn->unknown[1]=1;
gmn->unknown[2]=1;
gmn->unknown[3]=1;
entity_list.QueueClients(this, outapp, false);
safe_delete(outapp);
}
void NPC::ClearLastName()
{
std::string WT;
WT = '\0'; //Clear Last Name
ChangeLastName( WT.c_str());
}
void NPC::DepopSwarmPets()
{
if (GetSwarmInfo()) {
+3
View File
@@ -361,6 +361,9 @@ public:
const bool IsUnderwaterOnly() const { return NPCTypedata->underwater; }
const char* GetRawNPCTypeName() const { return NPCTypedata->name; }
void ChangeLastName(const char* in_lastname);
void ClearLastName();
bool GetDepop() { return p_depop; }
void NPCSlotTexture(uint8 slot, uint16 texture); // Sets new material values for slots
+88
View File
@@ -795,6 +795,42 @@ XS(XS_NPC_IsOnHatelist)
XSRETURN(1);
}
XS(XS_NPC_RemoveFromHateList); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_RemoveFromHateList)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: NPC::RemoveFromHateList(THIS, ent)");
{
NPC * THIS;
Mob* ent;
if (sv_derived_from(ST(0), "NPC")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(NPC *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type NPC");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (sv_derived_from(ST(1), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(1)));
ent = INT2PTR(Mob *,tmp);
}
else
Perl_croak(aTHX_ "ent is not of type Mob");
if(ent == nullptr)
Perl_croak(aTHX_ "ent is nullptr, avoiding crash.");
THIS->RemoveFromHateList(ent);
}
XSRETURN_EMPTY;
}
XS(XS_NPC_SetNPCFactionID); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_SetNPCFactionID)
{
@@ -2373,6 +2409,55 @@ XS(XS_NPC_AddDefensiveProc) {
XSRETURN_EMPTY;
}
XS(XS_NPC_ChangeLastName); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_ChangeLastName)
{
dXSARGS;
if (items < 1 || items > 2)
Perl_croak(aTHX_ "Usage: Mob::ChangeLastName(THIS, name)");
{
NPC * THIS;
char * name = nullptr;
if (sv_derived_from(ST(0), "NPC")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(NPC *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type NPC");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
if (items > 1) { name = (char *)SvPV_nolen(ST(1)); }
THIS->ChangeLastName(name);
}
XSRETURN_EMPTY;
}
XS(XS_NPC_ClearLastName); /* prototype to pass -Wmissing-prototypes */
XS(XS_NPC_ClearLastName)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::ClearLastName(THIS)");
{
NPC * THIS;
if (sv_derived_from(ST(0), "NPC")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(NPC *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type NPC");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->ClearLastName();
}
XSRETURN_EMPTY;
}
#ifdef __cplusplus
extern "C"
#endif
@@ -2420,6 +2505,7 @@ XS(boot_NPC)
newXSproto(strcpy(buf, "GetPrimaryFaction"), XS_NPC_GetPrimaryFaction, file, "$");
newXSproto(strcpy(buf, "GetNPCHate"), XS_NPC_GetNPCHate, file, "$$");
newXSproto(strcpy(buf, "IsOnHatelist"), XS_NPC_IsOnHatelist, file, "$$");
newXSproto(strcpy(buf, "RemoveFromHateList"), XS_NPC_RemoveFromHateList, file, "$$");
newXSproto(strcpy(buf, "SetNPCFactionID"), XS_NPC_SetNPCFactionID, file, "$$");
newXSproto(strcpy(buf, "GetMaxDMG"), XS_NPC_GetMaxDMG, file, "$");
newXSproto(strcpy(buf, "GetMinDMG"), XS_NPC_GetMinDMG, file, "$");
@@ -2480,6 +2566,8 @@ XS(boot_NPC)
newXSproto(strcpy(buf, "AddMeleeProc"), XS_NPC_AddMeleeProc, file, "$$$");
newXSproto(strcpy(buf, "AddRangedProc"), XS_NPC_AddRangedProc, file, "$$$");
newXSproto(strcpy(buf, "AddDefensiveProc"), XS_NPC_AddDefensiveProc, file, "$$$");
newXSproto(strcpy(buf, "ChangeLastName"), XS_NPC_ChangeLastName, file, "$:$");
newXSproto(strcpy(buf, "ClearLastName"), XS_NPC_ClearLastName, file, "$");
XSRETURN_YES;
}
+3 -3
View File
@@ -108,7 +108,7 @@ void Trade::AddEntity(uint16 trade_slot_id, uint32 stack_size) {
ItemInst* inst2 = client->GetInv().GetItem(trade_slot_id);
// it looks like the original code attempted to allow stacking...
// (it just didn't handle partial stack move actions -U)
// (it just didn't handle partial stack move actions)
if (stack_size > 0) {
if (!inst->IsStackable() || !inst2 || !inst2->GetItem() || (inst->GetID() != inst2->GetID()) || (stack_size > inst->GetCharges())) {
client->Kick();
@@ -800,7 +800,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
// QS code
if(RuleB(QueryServ, PlayerLogTrades) && event_entry && event_details) {
// Currently provides only basic functionality. Calling method will also
// need to be modified before item returns and rewards can be logged. -U
// need to be modified before item returns and rewards can be logged.
qs_audit = (QSPlayerLogHandin_Struct*)event_entry;
qs_log = true;
@@ -819,7 +819,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
qs_audit->npc_count = 0;
}
if(qs_log) { // This can be incorporated below when revisions are made -U
if(qs_log) { // This can be incorporated below when revisions are made
for (int16 trade_slot = EmuConstants::TRADE_BEGIN; trade_slot <= EmuConstants::TRADE_NPC_END; ++trade_slot) {
const ItemInst* trade_inst = m_inv[trade_slot];