Augment item events

This commit is contained in:
KimLS
2013-06-21 14:20:30 -07:00
parent 7b894a7c61
commit 7af04798fb
13 changed files with 182 additions and 16 deletions
+29 -4
View File
@@ -139,9 +139,21 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
// Adding augment
if (in_augment->augment_slot == -1)
{
if (((slot=tobe_auged->AvailableAugmentSlot(auged_with->GetAugmentType()))!=-1) && (tobe_auged->AvailableWearSlot(auged_with->GetItem()->Slots)))
if (((slot=tobe_auged->AvailableAugmentSlot(auged_with->GetAugmentType()))!=-1) &&
(tobe_auged->AvailableWearSlot(auged_with->GetItem()->Slots)))
{
tobe_auged->PutAugment(slot,*auged_with);
tobe_auged->PutAugment(slot, *auged_with);
ItemInst *aug = tobe_auged->GetAugment(slot);
if(aug) {
std::vector<void*> args;
args.push_back(aug);
parse->EventItem(EVENT_AUGMENT_ITEM, user, tobe_auged, nullptr, "", slot, &args);
args.assign(1, tobe_auged);
parse->EventItem(EVENT_AUGMENT_INSERT, user, aug, nullptr, "", slot, &args);
}
itemOneToPush = tobe_auged->Clone();
deleteItems = true;
}
@@ -152,6 +164,16 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
}
else
{
ItemInst *aug = tobe_auged->GetAugment(in_augment->augment_slot);
if(aug) {
std::vector<void*> args;
args.push_back(aug);
parse->EventItem(EVENT_UNAUGMENT_ITEM, user, tobe_auged, nullptr, "", slot, &args);
args.assign(1, tobe_auged);
parse->EventItem(EVENT_AUGMENT_REMOVE, user, aug, nullptr, "", slot, &args);
}
ItemInst *old_aug=nullptr;
const uint32 id=auged_with->GetID();
if (id==40408 || id==40409 || id==40410)
@@ -163,6 +185,8 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
if (old_aug)
itemTwoToPush = old_aug->Clone();
deleteItems = true;
}
@@ -197,11 +221,12 @@ void Object::HandleAugmentation(Client* user, const AugmentItem_Struct* in_augme
// Must push items after the items in inventory are deleted - necessary due to lore items...
if (itemOneToPush)
{
user->PushItemOnCursor(*itemOneToPush,true);
user->PushItemOnCursor(*itemOneToPush, true);
}
if (itemTwoToPush)
{
user->PushItemOnCursor(*itemTwoToPush,true);
user->PushItemOnCursor(*itemTwoToPush, true);
}
}