1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | void Character::Logout() { if (! this ->online) { if ( this ->guild) { this ->guild->Release(); this ->guild = 0; } return ; } if ( this ->trading) { PacketBuilder builder(PACKET_TRADE, PACKET_CLOSE); builder.AddShort( this ->id); this ->trade_partner->player->client->SendBuilder(builder); this ->player->client->state = EOClient::Playing; this ->trading = false ; this ->trade_inventory.clear(); this ->trade_agree = false ; this ->trade_partner->player->client->state = EOClient::Playing; this ->trade_partner->trading = false ; this ->trade_partner->trade_inventory.clear(); this ->trade_agree = false ; this ->trade_partner->trade_partner = 0; this ->trade_partner = 0; } if ( this ->party) { this ->party->Leave( this ); } if ( this ->arena) { -- this ->arena->occupants; } UTIL_PTR_LIST_FOREACH( this ->unregister_npc, NPC, npc) { UTIL_PTR_LIST_FOREACH(npc->damagelist, NPC_Opponent, checkopp) { if (checkopp->attacker == this ) { npc->totaldamage -= checkopp->damage; npc->damagelist.erase(checkopp); break ; } } } if ( this ->has_pet) { erase_first( this ->map->npcs, this ->pet); this ->pet->Release(); this ->has_pet = false ; } this ->online = false ; this ->Save(); this ->world->Logout( this ); } |