add collection item via loot box
Posted: Thu Sep 14, 2017 2:29 pm
so the loot box appears with this funtion
i would like to call loot fuction from the groundspawn.cpp
what i cant figure out is how to get this
converted into this
Code: Select all
void Client::Loot(int32 total_coins, vector<Item*>* items, Entity* entity ){
if(!entity){
CloseLoot();
return;
}
if(total_coins > 0){
player->AddCoins(total_coins);
//PlaySound("coin_cha_ching");
string message = "";
if(entity->GetHP() == 0){
message = "You loot ";
entity->SetLootCoins(0);
}
else
message = "You receive ";
message.append(GetCoinMessage(total_coins));
if(entity->GetHP() == 0)
message.append(" from the corpse of ").append(entity->GetName());
int8 type = CHANNEL_COLOR_LOOT;
if (GetVersion() >= 1208)
type = CHANNEL_LOOT;
else if(GetVersion() >= 973)
type = CHANNEL_COLOR_NEW_LOOT;
SimpleMessage(type, message.c_str());
}
if(!items || items->size() == 0)
CloseLoot();
vector<Item*>::iterator itr;
for (itr = items->begin(); itr != items->end(); itr++){
Item* item = 0;
item = *itr;
LogWrite(PLAYER__DEBUG, 1, "Robert Lore", "Checking for Lore:%i Result: %i", item->generic_info.item_flags, item->generic_info.item_flags & LORE);
if ((item->generic_info.item_flags & LORE) >0){
LogWrite(PLAYER__DEBUG, 1, "Robert Lore", "Found a Lore Item Flag %i result: %i", item->generic_info.item_flags, item->generic_info.item_flags & LORE );
//code to remove item from the list
}
}
PacketStruct* packet = configReader.getStruct("WS_UpdateLoot", GetVersion());
if(packet){
vector<Item*>::iterator itr;........continuedwhat i cant figure out is how to get this
Code: Select all
client->AddItem(item);Code: Select all
client->Loot(0, item* , client->GetPlayer());