mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-03 21:42:26 +00:00
fixed client lua summonitem.
export npc:CanTalk to lua. added QuestSlot. Added a condition for questslot in summonitem function.
This commit is contained in:
parent
56c7db4cbf
commit
caae34ac5e
@ -89,6 +89,8 @@ namespace EQ
|
|||||||
using RoF2::invslot::SLOT_INVALID;
|
using RoF2::invslot::SLOT_INVALID;
|
||||||
using RoF2::invslot::SLOT_BEGIN;
|
using RoF2::invslot::SLOT_BEGIN;
|
||||||
|
|
||||||
|
using RoF2::invslot::SLOT_QUEST;
|
||||||
|
|
||||||
using Titanium::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE;
|
using Titanium::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE;
|
||||||
|
|
||||||
const int16 SLOT_AUGMENT_GENERIC_RETURN = 1001; // clients don't appear to use this method... (internal inventory return value)
|
const int16 SLOT_AUGMENT_GENERIC_RETURN = 1001; // clients don't appear to use this method... (internal inventory return value)
|
||||||
|
|||||||
@ -165,6 +165,8 @@ namespace RoF2
|
|||||||
const int16 SLOT_INVALID = IINVALID;
|
const int16 SLOT_INVALID = IINVALID;
|
||||||
const int16 SLOT_BEGIN = INULL;
|
const int16 SLOT_BEGIN = INULL;
|
||||||
|
|
||||||
|
const int16 SLOT_QUEST = 9999;
|
||||||
|
|
||||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||||
const int16 POSSESSIONS_END = slotCursor;
|
const int16 POSSESSIONS_END = slotCursor;
|
||||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||||
|
|||||||
@ -162,6 +162,8 @@ namespace RoF
|
|||||||
const int16 SLOT_INVALID = IINVALID;
|
const int16 SLOT_INVALID = IINVALID;
|
||||||
const int16 SLOT_BEGIN = INULL;
|
const int16 SLOT_BEGIN = INULL;
|
||||||
|
|
||||||
|
const int16 SLOT_QUEST = 9999;
|
||||||
|
|
||||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||||
const int16 POSSESSIONS_END = slotCursor;
|
const int16 POSSESSIONS_END = slotCursor;
|
||||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||||
|
|||||||
@ -152,6 +152,8 @@ namespace SoD
|
|||||||
|
|
||||||
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
||||||
|
|
||||||
|
const int16 SLOT_QUEST = 9999;
|
||||||
|
|
||||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||||
const int16 POSSESSIONS_END = slotCursor;
|
const int16 POSSESSIONS_END = slotCursor;
|
||||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||||
|
|||||||
@ -152,6 +152,8 @@ namespace SoF
|
|||||||
|
|
||||||
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
||||||
|
|
||||||
|
const int16 SLOT_QUEST = 9999;
|
||||||
|
|
||||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||||
const int16 POSSESSIONS_END = slotCursor;
|
const int16 POSSESSIONS_END = slotCursor;
|
||||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||||
|
|||||||
@ -151,6 +151,8 @@ namespace Titanium
|
|||||||
|
|
||||||
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
||||||
|
|
||||||
|
const int16 SLOT_QUEST = 9999;
|
||||||
|
|
||||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||||
const int16 POSSESSIONS_END = slotCursor;
|
const int16 POSSESSIONS_END = slotCursor;
|
||||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||||
|
|||||||
@ -152,6 +152,8 @@ namespace UF
|
|||||||
|
|
||||||
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
||||||
|
|
||||||
|
const int16 SLOT_QUEST = 9999;
|
||||||
|
|
||||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||||
const int16 POSSESSIONS_END = slotCursor;
|
const int16 POSSESSIONS_END = slotCursor;
|
||||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||||
|
|||||||
@ -2816,6 +2816,9 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
|
|||||||
|
|
||||||
entity_list.RemoveFromAutoXTargets(this);
|
entity_list.RemoveFromAutoXTargets(this);
|
||||||
|
|
||||||
|
// Here we create the corpse.
|
||||||
|
DeleteInvalidQuestLoot();
|
||||||
|
|
||||||
corpse = new Corpse(
|
corpse = new Corpse(
|
||||||
this,
|
this,
|
||||||
&m_loot_items,
|
&m_loot_items,
|
||||||
|
|||||||
@ -601,7 +601,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
|||||||
inst->SetOrnamentHeroModel(ornament_hero_model);
|
inst->SetOrnamentHeroModel(ornament_hero_model);
|
||||||
|
|
||||||
// check to see if item is usable in requested slot
|
// check to see if item is usable in requested slot
|
||||||
if (enforce_usable && (to_slot >= EQ::invslot::EQUIPMENT_BEGIN && to_slot <= EQ::invslot::EQUIPMENT_END)) {
|
if (enforce_usable && to_slot != EQ::invslot::SLOT_QUEST && (to_slot >= EQ::invslot::EQUIPMENT_BEGIN && to_slot <= EQ::invslot::EQUIPMENT_END)) {
|
||||||
uint32 slottest = to_slot;
|
uint32 slottest = to_slot;
|
||||||
if(!(slots & ((uint32)1 << slottest))) {
|
if(!(slots & ((uint32)1 << slottest))) {
|
||||||
Message(
|
Message(
|
||||||
@ -648,6 +648,34 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
|
|||||||
|
|
||||||
RecordPlayerEventLog(PlayerEvent::ITEM_CREATION, e);
|
RecordPlayerEventLog(PlayerEvent::ITEM_CREATION, e);
|
||||||
}
|
}
|
||||||
|
//We're coming from a quest method.
|
||||||
|
if (to_slot == EQ::invslot::SLOT_QUEST) {
|
||||||
|
bool stacking = TryStacking(inst);
|
||||||
|
if (stacking) {
|
||||||
|
safe_delete(inst);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bool bag = false;
|
||||||
|
if (inst->IsClassBag()) {
|
||||||
|
bag = true;
|
||||||
|
}
|
||||||
|
to_slot = m_inv.FindFreeSlot(bag, true, item->Size);
|
||||||
|
|
||||||
|
//make sure we are not completely full...
|
||||||
|
if (to_slot == EQ::invslot::slotCursor || to_slot == INVALID_INDEX) {
|
||||||
|
if (inst->GetItem()->NoDrop == 0) {
|
||||||
|
//If it's no drop, force it to the cursor. This carries the risk of deletion if the player already has this item on their cursor
|
||||||
|
// or if the cursor queue is full. But in this situation, we have little other recourse.
|
||||||
|
PushItemOnCursor(*inst);
|
||||||
|
LogInventory("{} has a full inventory and {} is a no drop item. Forcing to cursor", GetName(), inst->GetItem()->Name);
|
||||||
|
safe_delete(inst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// put item into inventory
|
// put item into inventory
|
||||||
if (to_slot == EQ::invslot::slotCursor) {
|
if (to_slot == EQ::invslot::slotCursor) {
|
||||||
|
|||||||
@ -955,14 +955,19 @@ void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug
|
|||||||
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5);
|
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned) {
|
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6) {
|
||||||
Lua_Safe_Call_Void();
|
Lua_Safe_Call_Void();
|
||||||
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned);
|
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, aug6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, int to_slot) {
|
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, bool attuned) {
|
||||||
Lua_Safe_Call_Void();
|
Lua_Safe_Call_Void();
|
||||||
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, 0, attuned, to_slot);
|
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, aug6, 0, attuned);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lua_Client::SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6, bool attuned, int to_slot) {
|
||||||
|
Lua_Safe_Call_Void();
|
||||||
|
self->SummonItem(item_id, charges, aug1, aug2, aug3, aug4, aug5, aug6, 0, attuned, to_slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lua_Client::SetStats(int type, int value) {
|
void Lua_Client::SetStats(int type, int value) {
|
||||||
@ -3863,8 +3868,9 @@ luabind::scope lua_register_client() {
|
|||||||
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32))&Lua_Client::SummonItem)
|
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32))&Lua_Client::SummonItem)
|
||||||
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32))&Lua_Client::SummonItem)
|
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32))&Lua_Client::SummonItem)
|
||||||
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32))&Lua_Client::SummonItem)
|
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32))&Lua_Client::SummonItem)
|
||||||
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32,bool))&Lua_Client::SummonItem)
|
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32,uint32))&Lua_Client::SummonItem)
|
||||||
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32,bool,int))&Lua_Client::SummonItem)
|
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32,uint32,bool))&Lua_Client::SummonItem)
|
||||||
|
.def("SummonItem", (void(Lua_Client::*)(uint32,int,uint32,uint32,uint32,uint32,uint32,uint32,bool,int))&Lua_Client::SummonItem)
|
||||||
.def("SummonItemIntoInventory", (void(Lua_Client::*)(luabind::adl::object))&Lua_Client::SummonItemIntoInventory)
|
.def("SummonItemIntoInventory", (void(Lua_Client::*)(luabind::adl::object))&Lua_Client::SummonItemIntoInventory)
|
||||||
.def("TGB", (bool(Lua_Client::*)(void))&Lua_Client::TGB)
|
.def("TGB", (bool(Lua_Client::*)(void))&Lua_Client::TGB)
|
||||||
.def("TakeMoneyFromPP", (bool(Lua_Client::*)(uint64))&Lua_Client::TakeMoneyFromPP)
|
.def("TakeMoneyFromPP", (bool(Lua_Client::*)(uint64))&Lua_Client::TakeMoneyFromPP)
|
||||||
|
|||||||
@ -251,9 +251,10 @@ public:
|
|||||||
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3);
|
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3);
|
||||||
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4);
|
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4);
|
||||||
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5);
|
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5);
|
||||||
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5,
|
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6);
|
||||||
|
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6,
|
||||||
bool attuned);
|
bool attuned);
|
||||||
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5,
|
void SummonItem(uint32 item_id, int charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6,
|
||||||
bool attuned, int to_slot);
|
bool attuned, int to_slot);
|
||||||
void SummonBaggedItems(uint32 bag_item_id, luabind::adl::object bag_items_table);
|
void SummonBaggedItems(uint32 bag_item_id, luabind::adl::object bag_items_table);
|
||||||
void SetStats(int type, int value);
|
void SetStats(int type, int value);
|
||||||
|
|||||||
@ -920,6 +920,12 @@ int Lua_NPC::QuestLootCount(int itemid)
|
|||||||
return self->CountQuestItem(itemid);
|
return self->CountQuestItem(itemid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Lua_NPC::CanTalk()
|
||||||
|
{
|
||||||
|
Lua_Safe_Call_Bool();
|
||||||
|
return self->CanTalk();
|
||||||
|
}
|
||||||
|
|
||||||
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")
|
||||||
.def(luabind::constructor<>())
|
.def(luabind::constructor<>())
|
||||||
@ -946,6 +952,7 @@ luabind::scope lua_register_npc() {
|
|||||||
.def("AddPetLoot", (void(Lua_NPC:: *)(int, int)) & Lua_NPC::AddPetLoot)
|
.def("AddPetLoot", (void(Lua_NPC:: *)(int, int)) & Lua_NPC::AddPetLoot)
|
||||||
.def("AssignWaypoints", (void(Lua_NPC::*)(int))&Lua_NPC::AssignWaypoints)
|
.def("AssignWaypoints", (void(Lua_NPC::*)(int))&Lua_NPC::AssignWaypoints)
|
||||||
.def("CalculateNewWaypoint", (void(Lua_NPC::*)(void))&Lua_NPC::CalculateNewWaypoint)
|
.def("CalculateNewWaypoint", (void(Lua_NPC::*)(void))&Lua_NPC::CalculateNewWaypoint)
|
||||||
|
.def("CanTalk", (bool(Lua_NPC:: *)(void)) & Lua_NPC::CanTalk)
|
||||||
.def("ChangeLastName", (void(Lua_NPC::*)(std::string))&Lua_NPC::ChangeLastName)
|
.def("ChangeLastName", (void(Lua_NPC::*)(std::string))&Lua_NPC::ChangeLastName)
|
||||||
.def("CheckNPCFactionAlly", (int(Lua_NPC::*)(int))&Lua_NPC::CheckNPCFactionAlly)
|
.def("CheckNPCFactionAlly", (int(Lua_NPC::*)(int))&Lua_NPC::CheckNPCFactionAlly)
|
||||||
.def("ClearItemList", (void(Lua_NPC::*)(void))&Lua_NPC::ClearLootItems)
|
.def("ClearItemList", (void(Lua_NPC::*)(void))&Lua_NPC::ClearLootItems)
|
||||||
|
|||||||
@ -200,6 +200,7 @@ public:
|
|||||||
void DeleteQuestLoot(int itemid1, int itemid2, int itemid3, int itemid4);
|
void DeleteQuestLoot(int itemid1, int itemid2, int itemid3, int itemid4);
|
||||||
bool HasRequiredQuestLoot(int itemid1, int itemid2, int itemid3, int itemid4);
|
bool HasRequiredQuestLoot(int itemid1, int itemid2, int itemid3, int itemid4);
|
||||||
int QuestLootCount(int itemid);
|
int QuestLootCount(int itemid);
|
||||||
|
bool CanTalk();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -837,6 +837,15 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
|
|||||||
tradingWith->SayString(TRADE_BACK, GetCleanName());
|
tradingWith->SayString(TRADE_BACK, GetCleanName());
|
||||||
PushItemOnCursor(*baginst, true);
|
PushItemOnCursor(*baginst, true);
|
||||||
}
|
}
|
||||||
|
else if (bagitem->NoDrop != 0 && tradingWith->CastToNPC()->CountQuestItem(bagitem->ID) == 0) {
|
||||||
|
tradingWith->CastToNPC()->AddQuestLoot(bagitem->ID, baginst->GetCharges());
|
||||||
|
LogTrading("Adding loot item {} (bag) to non-Quest NPC {}", bagitem->Name, tradingWith->CastToNPC()->GetName());
|
||||||
|
}
|
||||||
|
// Destroy duplicate and nodrop items on charmed pets.
|
||||||
|
else if (bagitem->NoDrop != 0 && ((tradingWith->CastToNPC()->IsPet() && tradingWith->CastToNPC()->IsCharmed()) || (tradingWith->CastToNPC()->IsPet() && tradingWith->CastToNPC()->IsCharmed() && tradingWith->CastToNPC()->CountQuestItem(bagitem->ID) == 0))) {
|
||||||
|
tradingWith->CastToNPC()->AddPetLoot(bagitem->ID, baginst->GetCharges());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -868,6 +877,10 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
|
|||||||
tradingWith->SayString(TRADE_BACK, GetCleanName());
|
tradingWith->SayString(TRADE_BACK, GetCleanName());
|
||||||
PushItemOnCursor(*inst, true);
|
PushItemOnCursor(*inst, true);
|
||||||
}
|
}
|
||||||
|
// Add items to loottable without equipping and mark as quest.
|
||||||
|
else if (GetGM() || (item->NoDrop != 0 && tradingWith->CastToNPC()->CountQuestItem(item->ID) == 0)) {
|
||||||
|
tradingWith->CastToNPC()->AddQuestLoot(item->ID, inst->GetCharges());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user