Someone is playing with me with an exploit on the code from ItemDropPenalty. I think this because yesterday he played with the one from offlineshop by great, but I realized this quickly enough and stopped the system .. and it is too big a coincidence for this core to appear suddenly.
So this is the problem I'm paying to fix :
I have already checked some syserr but I don't notice anything strange
Bitte melden Sie sich an, um dieses Bild zu sehen.
My void CHARACTER::ItemDropPenalty
Code
- void CHARACTER::ItemDropPenalty(LPCHARACTER pkKiller)
- {
- // °³ÀλóÁ¡À» ¿¬ »óÅ¿¡¼´Â ¾ÆÀÌÅÛÀ» µå·ÓÇÏÁö ¾Ê´Â´Ù.
- if (GetMyShop())
- return;
- if (false == LC_IsYMIR())
- {
- if (GetLevel() < 50)
- return;
- }
- if (CBattleArena::instance().IsBattleArenaMap(GetMapIndex()) == true)
- {
- return;
- }
- struct TItemDropPenalty * table = &aItemDropPenalty_kor[0];
- if (GetLevel() < 10)
- return;
- int iAlignIndex;
- if (GetRealAlignment() >= 120000)
- iAlignIndex = 0;
- else if (GetRealAlignment() >= 80000)
- iAlignIndex = 1;
- else if (GetRealAlignment() >= 40000)
- iAlignIndex = 2;
- else if (GetRealAlignment() >= 10000)
- iAlignIndex = 3;
- else if (GetRealAlignment() >= 0)
- iAlignIndex = 4;
- else if (GetRealAlignment() > -40000)
- iAlignIndex = 5;
- else if (GetRealAlignment() > -80000)
- iAlignIndex = 6;
- else if (GetRealAlignment() > -120000)
- iAlignIndex = 7;
- else
- iAlignIndex = 8;
- std::vector<std::pair<LPITEM, int> > vec_item;
- LPITEM pkItem;
- int i;
- bool isDropAllEquipments = false;
- TItemDropPenalty & r = table[iAlignIndex];
- sys_log(0, "%s align %d inventory_pct %d equip_pct %d", GetName(), iAlignIndex, r.iInventoryPct, r.iEquipmentPct);
- bool bDropInventory = r.iInventoryPct >= number(1, 1000);
- bool bDropEquipment = r.iEquipmentPct >= number(1, 100);
- bool bDropAntiDropUniqueItem = false;
- if ((bDropInventory || bDropEquipment) && IsEquipUniqueItem(UNIQUE_ITEM_SKIP_ITEM_DROP_PENALTY))
- {
- bDropInventory = false;
- bDropEquipment = false;
- bDropAntiDropUniqueItem = true;
- }
- // @fixme198 BEGIN
- if (bDropInventory || bDropEquipment) {
- if (pkkiller)
- pkKiller->SetExchangeTime();
- SetExchangeTime();
- }
- // @fixme198 END
- if (bDropInventory) // Drop Inventory
- {
- std::vector<BYTE> vec_bSlots;
- for (i = 0; i < INVENTORY_MAX_NUM; ++i)
- if (GetInventoryItem(i))
- vec_bSlots.push_back(i);
- if (!vec_bSlots.empty())
- {
- random_shuffle(vec_bSlots.begin(), vec_bSlots.end());
- int iQty = MIN(vec_bSlots.size(), r.iInventoryQty);
- if (iQty)
- iQty = number(1, iQty);
- for (i = 0; i < iQty; ++i)
- {
- pkItem = GetInventoryItem(vec_bSlots[i]);
- if (IS_SET(pkItem->GetAntiFlag(), ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_PKDROP))
- continue;
- SyncQuickslot(QUICKSLOT_TYPE_ITEM, vec_bSlots[i], 255);
- vec_item.push_back(std::make_pair(pkItem->RemoveFromCharacter(), INVENTORY));
- }
- }
- else if (iAlignIndex == 8)
- isDropAllEquipments = true;
- }
- if (bDropEquipment) // Drop Equipment
- {
- std::vector<BYTE> vec_bSlots;
- for (i = 0; i < WEAR_MAX_NUM; ++i)
- if (GetWear(i))
- vec_bSlots.push_back(i);
- if (!vec_bSlots.empty())
- {
- random_shuffle(vec_bSlots.begin(), vec_bSlots.end());
- int iQty;
- if (isDropAllEquipments)
- iQty = vec_bSlots.size();
- else
- iQty = MIN(vec_bSlots.size(), number(1, r.iEquipmentQty));
- if (iQty)
- iQty = number(1, iQty);
- for (i = 0; i < iQty; ++i)
- {
- pkItem = GetWear(vec_bSlots[i]);
- if (IS_SET(pkItem->GetAntiFlag(), ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_PKDROP))
- continue;
- SyncQuickslot(QUICKSLOT_TYPE_ITEM, vec_bSlots[i], 255);
- vec_item.push_back(std::make_pair(pkItem->RemoveFromCharacter(), EQUIPMENT));
- }
- }
- }
- if (bDropAntiDropUniqueItem)
- {
- LPITEM pkItem;
- pkItem = GetWear(WEAR_UNIQUE1);
- if (pkItem && pkItem->GetVnum() == UNIQUE_ITEM_SKIP_ITEM_DROP_PENALTY)
- {
- SyncQuickslot(QUICKSLOT_TYPE_ITEM, WEAR_UNIQUE1, 255);
- vec_item.push_back(std::make_pair(pkItem->RemoveFromCharacter(), EQUIPMENT));
- }
- pkItem = GetWear(WEAR_UNIQUE2);
- if (pkItem && pkItem->GetVnum() == UNIQUE_ITEM_SKIP_ITEM_DROP_PENALTY)
- {
- SyncQuickslot(QUICKSLOT_TYPE_ITEM, WEAR_UNIQUE2, 255);
- vec_item.push_back(std::make_pair(pkItem->RemoveFromCharacter(), EQUIPMENT));
- }
- }
- {
- PIXEL_POSITION pos;
- pos.x = GetX();
- pos.y = GetY();
- unsigned int i;
- for (i = 0; i < vec_item.size(); ++i)
- {
- LPITEM item = vec_item[i].first;
- int window = vec_item[i].second;
- item->AddToGround(GetMapIndex(), pos);
- item->StartDestroyEvent();
- sys_log(0, "DROP_ITEM_PK: %s %d %d from %s", item->GetName(), pos.x, pos.y, GetName());
- LogManager::instance().ItemLog(this, item, "DEAD_DROP", (window == INVENTORY) ? "INVENTORY" : ((window == EQUIPMENT) ? "EQUIPMENT" : ""));
- pos.x = GetX() + number(-7, 7) * 20;
- #ifdef PENALTY_DUPE_DROP_FIX
- SetPenaltyWarpTime();
- #endif
- pos.y = GetY() + number(-7, 7) * 20;
- }
- }
- }