void WorldSession::HandleInitiateTrade(WorldPacket & recv_data) { CHECK_INWORLD_RETURN; CHECK_PACKET_SIZE(recv_data, 8); uint64 guid; recv_data >> guid; uint32 TradeStatus = TRADE_STATUS_PROPOSED; PlayerPointer pTarget = _player->GetMapMgr()->GetPlayer((uint32)guid); if(pTarget == NULL || !pTarget->IsInWorld()) TradeStatus = TRADE_STATUS_PLAYER_NOT_FOUND; else { // Handle possible error outcomes if(_player->isDead()) TradeStatus = TRADE_STATUS_DEAD; if(pTarget->isDead()) TradeStatus = TRADE_STATUS_TARGET_DEAD; else if(pTarget->mTradeTarget != 0) TradeStatus = TRADE_STATUS_ALREADY_TRADING; else if(pTarget->GetTeam() != _player->GetTeam() && GetPermissionCount() == 0) TradeStatus = TRADE_STATUS_WRONG_FACTION; else if(_player->CalcDistance(pTarget) > 10.0f) // This needs to be checked TradeStatus = TRADE_STATUS_TOO_FAR_AWAY; } if(TradeStatus != TRADE_STATUS_PROPOSED) { _player->ResetTradeVariables(); SendTradeStatus(TradeStatus); } else { _player->ResetTradeVariables(); pTarget->ResetTradeVariables(); pTarget->mTradeTarget = _player->GetLowGUID(); _player->mTradeTarget = pTarget->GetLowGUID(); pTarget->mTradeStatus = TradeStatus; _player->mTradeStatus = TradeStatus; WorldPacket data(SMSG_TRADE_STATUS, 12); data << TradeStatus; data << _player->GetGUID(); if(pTarget->m_session && pTarget->m_session->GetSocket()) pTarget->m_session->SendPacket(&data); } }
bool ChatHandler::HandleReviveStringcommand(const char* args, WorldSession* m_session) { PlayerPointer plr = objmgr.GetPlayer(args, false); if(!plr) { RedSystemMessage(m_session, "Could not find player %s.", args); return true; } if(plr->isDead()) { if(plr->GetInstanceID() == m_session->GetPlayer()->GetInstanceID()) plr->RemoteRevive(); else sEventMgr.AddEvent(plr, &Player::RemoteRevive, EVENT_PLAYER_REST, 1, 1,0); GreenSystemMessage(m_session, "Revived player %s.", args); } else { GreenSystemMessage(m_session, "Player %s is not dead.", args); } return true; }
bool ChatHandler::HandleKillByPlrCommand( const char *args , WorldSession *m_session ) { PlayerPointer plr = objmgr.GetPlayer(args, false); if(!plr) { RedSystemMessage(m_session, "Player %s is not online or does not exist.", args); return true; } if(plr->isDead()) { RedSystemMessage(m_session, "Player %s is already dead.", args); } else { plr->SetUInt32Value(UNIT_FIELD_HEALTH, 0); // Die, insect plr->KillPlayer(); BlueSystemMessageToPlr(plr, "You were killed by %s with a GM command.", m_session->GetPlayer()->GetName()); GreenSystemMessage(m_session, "Killed player %s.", args); sGMLog.writefromsession(m_session, "remote killed "I64FMT" (Name: %s)", plr->GetGUID(), plr->GetNameString() ); } return true; }
void ArathiBasin::HookOnAreaTrigger(PlayerPointer plr, uint32 id) { uint32 spellid=0; int32 buffslot = -1; switch(id) { case 3866: // stables buffslot=AB_BUFF_STABLES; break; case 3867: // farm buffslot=AB_BUFF_FARM; break; case 3870: // blacksmith buffslot=AB_BUFF_BLACKSMITH; break; case 3869: // mine buffslot=AB_BUFF_MINE; break; case 3868: // lumbermill buffslot=AB_BUFF_LUMBERMILL; break; case 3948: // alliance/horde exits case 3949: { RemovePlayer(plr,false); return; }break; default: Log.Error("ArathiBasin", "Encountered unhandled areatrigger id %u", id); return; break; } if(plr->isDead()) // dont apply to dead players... :P return; uint32 x = (uint32)buffslot; if(m_buffs[x] && m_buffs[x]->IsInWorld()) { // apply the spell spellid = m_buffs[x]->GetInfo()->sound3; m_buffs[x]->RemoveFromWorld(false); // respawn it in buffrespawntime sEventMgr.AddEvent(TO_ARATHIBASIN(shared_from_this()),&ArathiBasin::SpawnBuff,x,EVENT_AB_RESPAWN_BUFF,AB_BUFF_RESPAWN_TIME,1,EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); // cast the spell on the player SpellEntry * sp = dbcSpell.LookupEntryForced(spellid); if(sp) { SpellPointer pSpell(new Spell(plr, sp, true, NULLAURA)); SpellCastTargets targets(plr->GetGUID()); pSpell->prepare(&targets); } } }