ต้นหา
void obj_Zombie::DoDeath(bool fakeDeath)
ฝั่งWarZ_Server
แก้เป้น
void obj_Zombie::DoDeath(bool fakeDeath)
{
extern wiInventoryItem RollItem(const LootBoxConfig* lootCfg, int depth);
// drop loot
if(!fakeDeath && spawnObject->lootBoxCfg && HeroItemID != 20207)
{
wiInventoryItem wi = RollItem(spawnObject->lootBoxCfg, 0);
if(wi.itemID > 0)
{
// create random position around zombie
r3dPoint3D pos = GetPosition();
pos.y += 0.4f;
pos.x += u_GetRandom(-1, 1);
pos.z += u_GetRandom(-1, 1);
// create network object
obj_DroppedItem* obj = (obj_DroppedItem*)srv_CreateGameObject("obj_DroppedItem", "obj_DroppedItem", pos);
obj->SetNetworkID(gServerLogic.GetFreeNetId());
obj->NetworkLocal = true;
// vars
obj->m_Item = wi;
}
}
if(!fakeDeath && spawnObject->lootBoxCfg && HeroItemID == 20207 && gServerLogic.ginfo_.channel != 4)
{
for(int i = 0; i < 3; i++)
{
wiInventoryItem wi = RollItem(spawnObject->lootBoxCfg, 0);
if(wi.itemID > 0)
{
// create random position around zombie
r3dPoint3D pos = GetPosition();
pos.y += 0.4f;
pos.x += u_GetRandom(-1, 1);
pos.z += u_GetRandom(-1, 1);
// create network object
obj_DroppedItem* obj = (obj_DroppedItem*)srv_CreateGameObject("obj_DroppedItem", "obj_DroppedItem", pos);
obj->SetNetworkID(gServerLogic.GetFreeNetId());
obj->NetworkLocal = true;
// vars
obj->m_Item = wi;
}
}
}
if(!fakeDeath && spawnObject->lootBoxCfg && HeroItemID == 20207 && gServerLogic.ginfo_.channel == 4)
{
for(int i = 0; i < 5; i++)
{
wiInventoryItem wi = RollItem(spawnObject->lootBoxCfg, 0);
if(wi.itemID > 0)
{
// create random position around zombie
r3dPoint3D pos = GetPosition();
pos.y += 0.4f;
pos.x += u_GetRandom(-1, 1);
pos.z += u_GetRandom(-1, 1);
// create network object
obj_DroppedItem* obj = (obj_DroppedItem*)srv_CreateGameObject("obj_DroppedItem", "obj_DroppedItem", pos);
obj->SetNetworkID(gServerLogic.GetFreeNetId());
obj->NetworkLocal = true;
// vars
obj->m_Item = wi;
}
}
}
เดิมมม
extern wiInventoryItem RollItem(const LootBoxConfig* lootCfg, int depth);
// drop loot
if(!fakeDeath && spawnObject->lootBoxCfg)
{
wiInventoryItem wi = RollItem(spawnObject->lootBoxCfg, 0);
if(wi.itemID > 0)
{
// create random position around zombie
r3dPoint3D pos = GetPosition();
pos.y += 0.4f;
pos.x += u_GetRandom(-1, 1);
pos.z += u_GetRandom(-1, 1);
// create network object
obj_DroppedItem* obj = (obj_DroppedItem*)srv_CreateGameObject("obj_DroppedItem", "obj_DroppedItem", pos);
obj->SetNetworkID(gServerLogic.GetFreeNetId());
obj->NetworkLocal = true;
// vars
obj->m_Item = wi;
}
}