Example #1
0
bool ChatHandler::HandleSaveCommand(const char* /*args*/)
{
    Player* player = m_session->GetPlayer();

    // Jail by WarHead edited by Vlad
    if (player->m_jail_isjailed)
    {
        SendSysMessage(LANG_JAIL_DENIED);
        return true;
    }

    // save GM account without delay and output message
    if (m_session->GetSecurity() > SEC_PLAYER)
    {
        if (Player *target = getSelectedPlayer())
            target->SaveToDB();
        else
            player->SaveToDB();
        SendSysMessage(LANG_PLAYER_SAVED);
        return true;
    }

    // save if the player has last been saved over 20 seconds ago
    uint32 save_interval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
    if (save_interval == 0 || (save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS))
        player->SaveToDB();

    return true;
}
Example #2
0
bool HandleModPlayerGold(BaseConsole * pConsole, int argc, const char * argv[])
{
	if ( argc < 3 )
	{
		pConsole->Write( "ERROR:Not enough parameters.\r\n");
		return false;
	}

	const char	*PlayerName = argv[1];
	uint32	gold = atoi( argv[2] );

	Player *plr = objmgr.GetPlayer(PlayerName, false);
	if( !plr || plr->IsInWorld() == false )
	{
		pConsole->Write( "ERROR:Could not find player %s.\r\n", argv[1]);
		return true;
	}

	plr->ModGold( gold );
	plr->SaveToDB(false);

	plr->BroadcastMessage("You have received gold from a GM command.Your character has been saved");
	pConsole->Write( "SUCCESS:Player has received gold\r\n" );

	FILE *fp = fopen("ConsoleCommands.Log","at");
	if( fp )
	{
		fprintf(fp,"GUID = %u, name = %s, acct = %u has received gold = %u at %I64u \n",(uint32)plr->GetGUID(),plr->GetName(), plr->GetSession()->GetAccountId(),gold, UNIXTIME);
		fclose( fp );
	}
	return true;
}
Example #3
0
bool HandlePlayerAddTitle(BaseConsole * pConsole, int argc, const char * argv[])
{
	if ( argc < 3 )
	{
		pConsole->Write( "ERROR:Not enough parameters.\r\n");
		return false;
	}

	const char	*PlayerName = argv[1];
	uint32	Title = atoi( argv[2] );

	Player *plr = objmgr.GetPlayer(PlayerName, false);
	if( !plr || plr->IsInWorld() == false )
	{
		pConsole->Write( "ERROR:Could not find player %s.\r\n", argv[1]);
		return true;
	}

	plr->SetKnownTitle( static_cast< RankTitles >(Title), true );
	plr->SaveToDB(false);

	plr->BroadcastMessage("You have gained a new Title from a GM command.Your character has been saved");
	pConsole->Write( "SUCCESS:Player has learned spell\r\n" );

	FILE *fp = fopen("ConsoleCommands.Log","at");
	if( fp )
	{
		fprintf(fp,"GUID = %u, name = %s, acct = %u has earned title = %u at %I64u\n",(uint32)plr->GetGUID(),plr->GetName(), plr->GetSession()->GetAccountId(),Title, UNIXTIME );
		fclose( fp );
	}

	return true;
}
Example #4
0
bool HandleModPlayerLevel(BaseConsole * pConsole, int argc, const char * argv[])
{
	if ( argc < 3 )
	{
		pConsole->Write( "ERROR:Not enough parameters.\r\n");
		return false;
	}

	const char	*PlayerName = argv[1];
	uint32	LevelCount = atoi( argv[2] );

	Player *plr = objmgr.GetPlayer(PlayerName, false);
	if( !plr || plr->IsInWorld() == false )
	{
		pConsole->Write( "ERROR:Could not find player %s.\r\n", argv[1]);
		return true;
	}

	for( uint32 i=0;i<LevelCount; i++)
		plr->GiveXP( plr->GetUInt32Value(PLAYER_NEXT_LEVEL_XP) + 10, plr->GetGUID(), false );

	plr->SaveToDB(false);
	plr->BroadcastMessage("You have been leveled(%u) by a GM command.Your character has been saved",LevelCount);
	pConsole->Write( "SUCCESS:Player has been leveled\r\n" );

	FILE *fp = fopen("ConsoleCommands.Log","at");
	if( fp )
	{
		fprintf(fp,"GUID = %u, name = %s, acct = %u has been leveled = %u times at %I64u\n",(uint32)plr->GetGUID(),plr->GetName(), plr->GetSession()->GetAccountId(),LevelCount, UNIXTIME);
		fclose( fp );
	}

	return true;
}
Example #5
0
bool ChatHandler::HandleSaveCommand(char* /*args*/)
{
    Player* player = m_session->GetPlayer();

    // save GM account without delay and output message (testing, etc)
    if (GetAccessLevel() > SEC_PLAYER)
    {
        player->SaveToDB();
        SendSysMessage(LANG_PLAYER_SAVED);
        return true;
    }

    // save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning
    uint32 save_interval = sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE);
    if (save_interval == 0 || (save_interval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20 * IN_MILLISECONDS))
        player->SaveToDB();

    return true;
}
Example #6
0
bool ChatHandler::HandleSaveCommand(const char* /*args*/)
{
    Player *player = m_session->GetPlayer();

    // save GM account without delay and output message
    if (m_session->GetSecurity() > SEC_PLAYER)
    {
        player->SaveToDB();
        SendSysMessage(LANG_PLAYER_SAVED);
        return true;
    }

    // save if the player has last been saved over 20 seconds ago
    uint32 save_interval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
    if (save_interval == 0 || (save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS))
        player->SaveToDB();

    return true;
}
Example #7
0
bool ChatHandler::HandleRenameCommand(const char * args, WorldSession * m_session)
{
	// prevent buffer overflow
	if(strlen(args) > 100)
		return false;

	char name1[100];
	char name2[100];

	if(sscanf(args, "%s %s", name1, name2) != 2)
		return false;

	if(VerifyName(name2, strlen(name2)) == false)
	{
		RedSystemMessage(m_session, "That name is invalid or contains invalid characters.");
		return true;
	}

	string new_name = name2;
	PlayerInfo * pi = objmgr.GetPlayerInfoByName(name1);
	if(pi == 0)
	{
		RedSystemMessage(m_session, "Player not found with this name.");
		return true;
	}

	if( objmgr.GetPlayerInfoByName(new_name.c_str()) != NULL )
	{
		RedSystemMessage(m_session, "Player found with this name in use already.");
		return true;
	}

	objmgr.RenamePlayerInfo(pi, pi->name, new_name.c_str());

	free(pi->name);
	pi->name = strdup(new_name.c_str());

	// look in world for him
	Player* plr = objmgr.GetPlayer(pi->guid);
	if(plr != 0)
	{
		plr->SetName(new_name);
		BlueSystemMessageToPlr(plr, "%s changed your name to '%s'.", m_session->GetPlayer()->GetName(), new_name.c_str());
		plr->SaveToDB(false);
	}
	else
	{
		CharacterDatabase.WaitExecute("UPDATE characters SET name = '%s' WHERE guid = %u", CharacterDatabase.EscapeString(new_name).c_str(), (uint32)pi->guid);
	}

	GreenSystemMessage(m_session, "Changed name of '%s' to '%s'.", (char*)name1, (char*)name2);
	sGMLog.writefromsession(m_session, "renamed character %s (GUID: %u) to %s", (char*)name1, pi->guid, (char*)name2);
	sPlrLog.writefromsession(m_session, "GM renamed character %s (GUID: %u) to %s", (char*)name1, pi->guid, ((char*)name2));
	return true;
}
Example #8
0
bool HandleModPlayerProfessions(BaseConsole * pConsole, int argc, const char * argv[])
{
	if ( argc < 3 )
	{
		pConsole->Write( "ERROR:Not enough parameters.\r\n");
		return false;
	}

	const char	*PlayerName = argv[1];
	uint32	skilline = atoi( argv[2] );

	Player *plr = objmgr.GetPlayer(PlayerName, false);
	if( !plr || plr->IsInWorld() == false )
	{
		pConsole->Write( "ERROR:Could not find player %s.\r\n", argv[1]);
		return true;
	}

	bool can_learn = false;
	if( plr->GetUInt32Value( PLAYER_PROFESSION_SKILL_LINE_1 ) == skilline )
		can_learn = true;
	if( plr->GetUInt32Value( PLAYER_PROFESSION_SKILL_LINE_2 ) == skilline )
		can_learn = true;
	if( plr->GetUInt32Value( PLAYER_PROFESSION_SKILL_LINE_1 ) == 0 || plr->GetUInt32Value( PLAYER_PROFESSION_SKILL_LINE_2 ) == 0 )
	{
		can_learn = true;
		plr->LearnProfession( skilline );
	}

	if( can_learn == false )
	{
		pConsole->Write( "ERROR:Cannot learn more primary professions %s.\r\n", argv[1]);
		return true;
	}

	plr->_RemoveSkillLine(skilline);
	plr->RemoveSpellsFromLine(skilline);
	plr->_AddSkillLine(skilline, 525, 525);
	plr->LearnAllSpellsFromSkillLine( skilline, true, false );

	plr->SaveToDB(false);
	plr->BroadcastMessage("You have learned a new profession by a GM command.Your character has been saved");
	plr->BroadcastMessage("In case you have client User Interface issue, please use Taxi->Player tools and fixes->fix profession");
	pConsole->Write( "SUCCESS:Player has learned the profession\r\n" );
	FILE *fp = fopen("ConsoleCommands.Log","at");
	if( fp )
	{
		fprintf(fp,"GUID = %u, name = %s, acct = %u has learned profession = %u at %I64u \n",(uint32)plr->GetGUID(),plr->GetName(), plr->GetSession()->GetAccountId(),skilline, UNIXTIME);
		fclose( fp );
	}

	return true;
}
Example #9
0
bool ChatHandler::HandleSaveCommand(char const* args)
{
	if( !m_session )
		return false;

	sLog.outDebug("COMMAND: HandleSaveCommand");

	ChatHandler(m_session).SendSysMessage("Saving...");
	Player* pPlayer = m_session->GetPlayer();
	pPlayer->SaveToDB();
	ChatHandler(m_session).SendSysMessage("Save complete.");
	return true;
}
Example #10
0
void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
{
    std::string name;
    WorldPacket data;

    recv_data >> name;
    recv_data.rpos(0);

    std::stringstream ss;
    ss << "SELECT guid FROM characters WHERE name = '" << name << "'";

    QueryResult *result = sDatabase.Query( ss.str( ).c_str( ) );
    if (result)
    {
        delete result;

        data.Initialize(SMSG_CHAR_CREATE);
        data << (uint8)0x30;                      // Error codes below
        SendPacket( &data );

        return;
    }

    // loading characters
    ss.rdbuf()->str("");
    ss << "SELECT guid FROM characters WHERE acct=" << GetAccountId();
    result = sDatabase.Query( ss.str( ).c_str( ) );
    if (result)
    {
        if (result->GetRowCount() >= 10)
        {
            data.Initialize(SMSG_CHAR_CREATE);
            data << (uint8)0x2F;                  // Should be a better error code i think
            SendPacket( &data );
            delete result;
            return;
        }
        delete result;
    }

    Player * pNewChar = new Player;
    pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), recv_data );
    pNewChar->SetSession(this);                   // we need account id
    pNewChar->SaveToDB();

    delete pNewChar;

    data.Initialize( SMSG_CHAR_CREATE );
    data << (uint8)0x2D;                          // Error codes below
    SendPacket( &data );
}
Example #11
0
//GuildHouse Tele
bool ChatHandler::HandleGHCommand(const char* args)
{
        Player *chr = m_session->GetPlayer();

        if(chr->isInFlight())
        {
                //pokud hrac leti
                SendSysMessage(LANG_YOU_IN_FLIGHT);
                SetSentErrorMessage(true);
                return false;
        }

        if(chr->isInCombat())
        {
                //pokud je hrac v combatu
                SendSysMessage(LANG_YOU_IN_COMBAT);
                SetSentErrorMessage(true);
                return false;
        }

        if (chr->GetGuildId() == 0)
        {
                //pokud hrac nema guildu
                return false;
        }

        QueryResult result;
            result = CharacterDatabase.PQuery("SELECT `x`, `y`, `z`, `map` FROM `guildhouses` WHERE `guildId` = %u", chr->GetGuildId());
        if(result == NULL)
        {
                //pokud guilda nema guildhouse zapsany v tabulce guildhouses
                SendSysMessage("GH Port");
                return false;
        }


        float x, y, z;
        uint32 map;

        Field *fields = result->Fetch();
        x = fields[0].GetFloat();
        y = fields[1].GetFloat();
        z = fields[2].GetFloat();
        map = fields[3].GetUInt32();
        

        chr->SaveRecallPosition();
        chr->TeleportTo(map, x, y, z, 0);
        chr->SaveToDB();
        return true;
}
Example #12
0
void ClusterInterface::HandleCreatePlayer(WorldPacket & pck)
{
	uint32 accountid, size;
	uint16 opcode;

	pck >> accountid >> opcode >> size;

	if (_sessions[accountid] != NULL)
		return;

	WorldSession* s=new WorldSession(accountid, "", NULL);

	//construct the cmsg_char_create
	WorldPacket data(opcode, size);
	data.resize(size);
	memcpy((void*)data.contents(), pck.contents() + 10, size);

	Player * pNewChar = objmgr.CreatePlayer();
	pNewChar->SetSession(s);
	if(!pNewChar->Create( data ))
	{
		// failed.
		pNewChar->ok_to_remove = true;
		delete pNewChar;
		return;
	}

	pNewChar->UnSetBanned();
	pNewChar->addSpell(22027);	  // Remove Insignia

	if(pNewChar->getClass() == WARLOCK)
	{
		pNewChar->AddSummonSpell(416, 3110);		// imp fireball
		pNewChar->AddSummonSpell(417, 19505);
		pNewChar->AddSummonSpell(1860, 3716);
		pNewChar->AddSummonSpell(1863, 7814);
	}

	pNewChar->SaveToDB(true);
	pNewChar->ok_to_remove = true;
	delete pNewChar;
	delete s;

	//now lets send the info back, send accountid, we have no sessionid
	WorldPacket result(ICMSG_CREATE_PLAYER, 5);
	data << accountid << uint8(0x2F); //CHAR_CREATE_SUCCESS
	SendPacket(&result);
}
 // DEMONOLOGY WARLOCK
 static bool HandleCreateWarlockDemonologyItemSetCommand(ChatHandler* handler, const char* args)
 {
     Player* player = handler->GetSession()->GetPlayer();
     if (player->getClass() != CLASS_WARLOCK)
     {
         player->GetSession()->SendAreaTriggerMessage("You're not a warlock!");
         return false;
     }
     spec = "Demonology";
     player->SaveToDB();
     OverwriteTemplate(player, spec);
     ExtractGearTemplateToDB(player, spec);
     ExtractTalentTemplateToDB(player, spec);
     ExtractGlyphsTemplateToDB(player, spec);
     return true;
 }
 // SHADOW PRIEST
 static bool HandleCreatePriestShadowItemSetCommand(ChatHandler* handler, const char* args)
 {
     Player* player = handler->GetSession()->GetPlayer();
     if (player->getClass() != CLASS_PRIEST)
     {
         player->GetSession()->SendAreaTriggerMessage("You're not a priest!");
         return false;
     }
     spec = "Shadow";
     player->SaveToDB();
     OverwriteTemplate(player, spec);
     ExtractGearTemplateToDB(player, spec);
     ExtractTalentTemplateToDB(player, spec);
     ExtractGlyphsTemplateToDB(player, spec);
     return true;
 }
 // ENHANCEMENT SHAMAN
 static bool HandleCreateShamanEnhancementItemSetCommand(ChatHandler* handler, const char* args)
 {
     Player* player = handler->GetSession()->GetPlayer();
     if (player->getClass() != CLASS_SHAMAN)
     {
         player->GetSession()->SendAreaTriggerMessage("You're not a shaman!");
         return false;
     }
     spec = "Enhancement";
     player->SaveToDB();
     OverwriteTemplate(player, spec);
     ExtractGearTemplateToDB(player, spec);
     ExtractTalentTemplateToDB(player, spec);
     ExtractGlyphsTemplateToDB(player, spec);
     return true;
 }
 // RESTORATION DRUID
 static bool HandleCreateDruidRestorationItemSetCommand(ChatHandler* handler, const char* args)
 {
     Player* player = handler->GetSession()->GetPlayer();
     if (player->getClass() != CLASS_DRUID)
     {
         player->GetSession()->SendAreaTriggerMessage("You're not a druid!");
         return false;
     }
     spec = "Restoration";
     player->SaveToDB();
     OverwriteTemplate(player, spec);
     ExtractGearTemplateToDB(player, spec);
     ExtractTalentTemplateToDB(player, spec);
     ExtractGlyphsTemplateToDB(player, spec);
     return true;
 }
 // SURVIVAL HUNTER
 static bool HandleCreateHunterSurvivalItemSetCommand(ChatHandler* handler, const char* args)
 {
     Player* player = handler->GetSession()->GetPlayer();
     if (player->getClass() != CLASS_HUNTER)
     {
         player->GetSession()->SendAreaTriggerMessage("You're not a hunter!");
         return false;
     }
     spec = "Survival";
     player->SaveToDB();
     OverwriteTemplate(player, spec);
     ExtractGearTemplateToDB(player, spec);
     ExtractTalentTemplateToDB(player, spec);
     ExtractGlyphsTemplateToDB(player, spec);
     return true;
 }
 // SUBTLETY ROGUE
 static bool HandleCreateRogueSubtletyItemSetCommand(ChatHandler* handler, const char* args)
 {
     Player* player = handler->GetSession()->GetPlayer();
     if (player->getClass() != CLASS_ROGUE)
     {
         player->GetSession()->SendAreaTriggerMessage("You're not a rogue!");
         return false;
     }
     spec = "Subtlety";
     player->SaveToDB();
     OverwriteTemplate(player, spec);
     ExtractGearTemplateToDB(player, spec);
     ExtractTalentTemplateToDB(player, spec);
     ExtractGlyphsTemplateToDB(player, spec);
     return true;
 }
 // UNHOLY DEATHKNIGHT
 static bool HandleCreateDeathKnightUnholyItemSetCommand(ChatHandler* handler, const char* args)
 {
     Player* player = handler->GetSession()->GetPlayer();
     if (player->getClass() != CLASS_DEATH_KNIGHT)
     {
         player->GetSession()->SendAreaTriggerMessage("You're not a death knight!");
         return false;
     }
     spec = "Unholy";
     player->SaveToDB();
     OverwriteTemplate(player, spec);
     ExtractGearTemplateToDB(player, spec);
     ExtractTalentTemplateToDB(player, spec);
     ExtractGlyphsTemplateToDB(player, spec);
     return true;
 }
Example #20
0
bool ChatHandler::HandleSaveCommand(const char* args, WorldSession *m_session)
{
    Player* plr = getSelectedChar(m_session, true);

    uint32 timeLeft = plr->m_nextSave;
    if(timeLeft > 10000 && timeLeft < 100000 && !plr->ForceSaved)
    {
        plr->SaveToDB(false);
        plr->m_nextSave = timeLeft;
        plr->ForceSaved = true;
        GreenSystemMessage(m_session, "Player saved to DB");
    }
    else
        RedSystemMessage(m_session, "You can only save one extra time every 2 minutes.");
    return true;
}
Example #21
0
        static bool HandleGHCommand(ChatHandler* handler, const char* args)
        {
            Player *chr = handler->GetSession()->GetPlayer();

            if(chr->isInFlight())
            {
                    handler->PSendSysMessage(LANG_YOU_IN_FLIGHT);
                    //SetSentErrorMessage(true);
                    return false;
            }

            if(chr->isInCombat())
            {
                    handler->PSendSysMessage(LANG_YOU_IN_COMBAT);
                    //SetSentErrorMessage(true);
                    return false;
            }

            if (chr->GetGuildId() == 0)
            {
                    return false;
            }

            QueryResult result;
            result = CharacterDatabase.PQuery("SELECT `x`, `y`, `z`, `map` FROM `guildhouses` WHERE `guildId` = %u", chr->GetGuildId());
            if(!result)
            {
                    handler->PSendSysMessage("GH Port");
                    return false;
            }


            float x, y, z;
            uint32 map;

            Field *fields = result->Fetch();
            x = fields[0].GetFloat();
            y = fields[1].GetFloat();
            z = fields[2].GetFloat();
            map = fields[3].GetUInt32();
            

            chr->SaveRecallPosition();
            chr->TeleportTo(map, x, y, z, 0);
            chr->SaveToDB();
            return true;
        }
    static bool HandleBoutiqueFactionCommand(ChatHandler *handler, const char *args) {
        Player* target = handler->GetSession()->GetPlayer();

        const char* reqcount = "SELECT id FROM boutique_service_achat WHERE accountId='%u' AND type=4 AND recup=0 LIMIT 1";

        sLog->outDebug(LOG_FILTER_NETWORKIO, reqcount, handler->GetSession()->GetAccountId());
        QueryResult resultcount = LoginDatabase.PQuery(reqcount, handler->GetSession()->GetAccountId());        
        if (!resultcount) {
            //Vous ne disposez actuellement d'aucun service de ce type. Vous pouvez acheter ce service sur la boutique
            handler->PSendSysMessage(11016);
            return true;
        }

        Field* fieldscount = resultcount->Fetch();
		
        const char* qmask = "SELECT 1 FROM boutique_service WHERE realmMask & '%u' != 0 and type = 4";
        QueryResult reqmask = LoginDatabase.PQuery(qmask, (1<<(realmID-1)));        
        if (!reqmask) {
            //Ce produit ou service n'est pas disponible pour ce royaume.
            handler->PSendSysMessage(11018);
            return true;
        }
		
        const char* reqallowed = "SELECT value FROM data WHERE RealmID = %u AND identifier = 'lowestFaction';";
        sLog->outDebug(LOG_FILTER_NETWORKIO, reqallowed, realmID);
        QueryResult resultallowed = LoginDatabase.PQuery(reqallowed, realmID);
        Field* fieldsallowed = resultallowed->Fetch();
        if (fieldsallowed[0].GetInt32()==target->GetTeamId()) {
            //Changement impossible vers l'autre faction car trop peuplée
            handler->PSendSysMessage(12007);
            return true;
        }

        if (target)
        {
            //Le changement de faction est valide. Vous pourrez effectuer le changement sur l'ecran des personnages
            handler->PSendSysMessage(12008);
            target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
            CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '64' WHERE guid = '%u'", target->GetGUIDLow());

            target->SaveToDB();
            const char* requpdate = "UPDATE boutique_service_achat SET realmID = '%u', recup='%u' WHERE id='%u'";
            LoginDatabase.PExecute(requpdate, realmID, (uint32)handler->GetSession()->GetPlayer()->GetGUID(), fieldscount[0].GetInt32());
        }

        return true;
    }
Example #23
0
int ClientMgr::CreateNewPlayer(Session* session, WorldPacket& data)
{
	SNLock[SN_PLAYER_GUID].Acquire();
	if(SNContainer[SN_PLAYER_GUID]+1 == 0) // We've reset the count :O
	{
		SNLock[SN_PLAYER_GUID].Release();
		return 1;
	}

	DEBUG_LOG("ClientMgr", "Account(%u) creating a player", session->GetAccountId());
	Player* plr = new Player(++SNContainer[SN_PLAYER_GUID]);
	SNLock[SN_PLAYER_GUID].Release();

	uint8 error = plr->Create(session, data);
	if(error)
		return error;

	plr->SaveToDB(true);
	return 0;
}
Example #24
0
bool HandlePlayerSave(BaseConsole * pConsole, int argc, const char * argv[])
{
	if ( argc < 2 )
	{
		pConsole->Write( "ERROR:Not enough parameters.\r\n");
		return false;
	}

	const char	*PlayerName = argv[1];

	Player *plr = objmgr.GetPlayer(PlayerName, false);
	if( !plr || plr->IsInWorld() == false )
	{
		pConsole->Write( "ERROR:Could not find player %s.\r\n", argv[1]);
		return true;
	}

	plr->SaveToDB(false);
	pConsole->Write( "SUCCESS:Player has been saved\r\n" );

	return true;
}
    static bool HandleBoutiqueRaceCommand(ChatHandler *handler, const char *args) {
        Player* target = handler->GetSession()->GetPlayer();

        const char* reqcount = "SELECT id FROM boutique_service_achat WHERE accountId='%u' AND type=3 AND recup=0 LIMIT 1";

        sLog->outDebug(LOG_FILTER_NETWORKIO, reqcount, handler->GetSession()->GetAccountId());
        QueryResult resultcount = LoginDatabase.PQuery(reqcount, handler->GetSession()->GetAccountId());

        if (!resultcount) {
            //Vous ne disposez actuellement d'aucun service de ce type. Vous pouvez acheter ce service sur la boutique
            handler->PSendSysMessage(11016);
            return true;
        }

        Field* fieldscount = resultcount->Fetch();

        const char* qmask = "SELECT 1 FROM boutique_service WHERE realmMask & '%u' != 0 and type = 3";
        QueryResult reqmask = LoginDatabase.PQuery(qmask, (1<<(realmID-1)));
        if (!reqmask) {
            //Ce produit ou service n'est pas disponible pour ce royaume.
            handler->PSendSysMessage(11018);
            return true;
        }
		
		
        if (target)
        {
            //Le changement de race est valide. Vous pourrez effectuer le changement sur l'ecran des personnages
            handler->PSendSysMessage(12009);
            target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
            CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '128' WHERE guid = %u", target->GetGUIDLow());

            target->SaveToDB();
            const char* requpdate = "UPDATE boutique_service_achat SET realmID = '%u', recup='%u' WHERE id='%u'";
            LoginDatabase.PExecute(requpdate, realmID, (uint32)handler->GetSession()->GetPlayer()->GetGUID(), fieldscount[0].GetInt32());
        }

        return true;
    }
Example #26
0
bool HandleModPlayerTalents(BaseConsole * pConsole, int argc, const char * argv[])
{
	if ( argc < 3 )
	{
		pConsole->Write( "ERROR:Not enough parameters.\r\n");
		return false;
	}

	const char	*PlayerName = argv[1];
	uint32	TalentCount = atoi( argv[2] );

	Player *plr = objmgr.GetPlayer(PlayerName, false);
	if( !plr || plr->IsInWorld() == false )
	{
		pConsole->Write( "ERROR:Could not find player %s.\r\n", argv[1]);
		return true;
	}

	plr->m_Talent_point_mods += TalentCount;
	plr->m_Talent_point_mods = MAX( 0, plr->m_Talent_point_mods );
	int32 tp = (int32) plr->CalcTalentPointsShouldHaveMax() - plr->CalcTalentPointsHaveSpent( plr->m_talentActiveSpec );
	if( tp < 0 )
		tp = 0;
	plr->SetUInt32Value( PLAYER_CHARACTER_POINTS, tp );
	plr->smsg_TalentsInfo( );

	plr->SaveToDB(false);
	plr->BroadcastMessage("You talentpoint count has been moded(%u) by a GM command.Your character has been saved",TalentCount);
	pConsole->Write( "SUCCESS:Player has received extra talentpoints\r\n" );
	FILE *fp = fopen("ConsoleCommands.Log","at");
	if( fp )
	{
		fprintf(fp,"GUID = %u, name = %s, acct = %u has received extra talents = %u at %I64u \n",(uint32)plr->GetGUID(),plr->GetName(), plr->GetSession()->GetAccountId(),TalentCount, UNIXTIME);
		fclose( fp );
	}
	return true;
}
    static bool HandleBoutiquePOCommand(ChatHandler *handler, const char *args) {
        const char* reqcount = "SELECT id FROM boutique_service_achat WHERE accountId='%u' AND type=2 AND recup=0 LIMIT 1";

        sLog->outDebug(LOG_FILTER_NETWORKIO, reqcount, handler->GetSession()->GetAccountId());
        QueryResult resultcount = LoginDatabase.PQuery(reqcount, handler->GetSession()->GetAccountId());

        if (!resultcount) {
            //Vous ne disposez actuellement d'aucun service de ce type. Vous pouvez acheter ce service sur la boutique
            handler->PSendSysMessage(11016);
            return true;
        }        

		
        const char* qmask = "SELECT 1 FROM boutique_service WHERE realmMask & '%u' != 0 and type = 2";
        QueryResult reqmask = LoginDatabase.PQuery(qmask, (1<<(realmID-1)));
        if (!reqmask) {
            //Ce produit ou service n'est pas disponible pour ce royaume.
            handler->PSendSysMessage(11018);
            return true;
        }
		
        Field *fieldscount = resultcount->Fetch();
        int id = fieldscount[0].GetInt32();

        sLog->outDebug(LOG_FILTER_NETWORKIO, "NOBODIE boutique po %u", fieldscount[0].GetInt32());

        Player* target = handler->GetSession()->GetPlayer();
        if (target) {
            target->SetMoney(target->GetMoney()+(2000*100*100));

            target->SaveToDB();
            const char* requpdate = "UPDATE boutique_service_achat SET realmID = '%u', recup='%u' WHERE id='%u'";
            LoginDatabase.PExecute(requpdate, realmID, (uint32)handler->GetSession()->GetPlayer()->GetGUIDLow(), id);
        }

        return true;
    }
Example #28
0
void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
{
    std::string name;
    uint8 race_, class_;

    recv_data >> name;

    recv_data >> race_;
    recv_data >> class_;

    WorldPacket data(SMSG_CHAR_CREATE, 1);                  // returned with diff.values in all cases

    if(GetSecurity() == SEC_PLAYER)
    {
        if(uint32 mask = sWorld.getConfig(CONFIG_CHARACTERS_CREATING_DISABLED))
        {
            bool disabled = false;

            uint32 team = Player::TeamForRace(race_);
            switch(team)
            {
                case ALLIANCE: disabled = mask & (1 << 0); break;
                case HORDE:    disabled = mask & (1 << 1); break;
            }

            if(disabled)
            {
                data << (uint8)CHAR_CREATE_DISABLED;
                SendPacket( &data );
                return;
            }
        }
    }

    ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
    ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_);

    if( !classEntry || !raceEntry )
    {
        data << (uint8)CHAR_CREATE_FAILED;
        SendPacket( &data );
        sLog.outError("Class: %u or Race %u not found in DBC (Wrong DBC files?) or Cheater?", class_, race_);
        return;
    }

    // prevent character creating Expansion race without Expansion account
    if (raceEntry->expansion > Expansion())
    {
        data << (uint8)CHAR_CREATE_EXPANSION;
        sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_);
        SendPacket( &data );
        return;
    }

    // prevent character creating Expansion class without Expansion account
    if (classEntry->expansion > Expansion())
    {
        data << (uint8)CHAR_CREATE_EXPANSION_CLASS;
        sLog.outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_);
        SendPacket( &data );
        return;
    }

    // prevent character creating with invalid name
    if (!normalizePlayerName(name))
    {
        data << (uint8)CHAR_NAME_NO_NAME;
        SendPacket( &data );
        sLog.outError("Account:[%d] but tried to Create character with empty [name]", GetAccountId());
        return;
    }

    // check name limitations
    uint8 res = ObjectMgr::CheckPlayerName(name, true);
    if (res != CHAR_NAME_SUCCESS)
    {
        data << uint8(res);
        SendPacket( &data );
        return;
    }

    if (GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(name))
    {
        data << (uint8)CHAR_NAME_RESERVED;
        SendPacket( &data );
        return;
    }

    if (objmgr.GetPlayerGUIDByName(name))
    {
        data << (uint8)CHAR_CREATE_NAME_IN_USE;
        SendPacket( &data );
        return;
    }

    QueryResult *resultacct = loginDatabase.PQuery("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '%d'", GetAccountId());
    if (resultacct)
    {
        Field *fields=resultacct->Fetch();
        uint32 acctcharcount = fields[0].GetUInt32();
        delete resultacct;

        if (acctcharcount >= sWorld.getConfig(CONFIG_CHARACTERS_PER_ACCOUNT))
        {
            data << (uint8)CHAR_CREATE_ACCOUNT_LIMIT;
            SendPacket( &data );
            return;
        }
    }

    QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", GetAccountId());
    uint8 charcount = 0;
    if ( result )
    {
        Field *fields = result->Fetch();
        charcount = fields[0].GetUInt8();
        delete result;

        if (charcount >= sWorld.getConfig(CONFIG_CHARACTERS_PER_REALM))
        {
            data << (uint8)CHAR_CREATE_SERVER_LIMIT;
            SendPacket( &data );
            return;
        }
    }

    // speedup check for heroic class disabled case
    uint32 heroic_free_slots = sWorld.getConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM);
    if(heroic_free_slots == 0 && GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
    {
        data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
        SendPacket( &data );
        return;
    }

    // speedup check for heroic class disabled case
    uint32 req_level_for_heroic = sWorld.getConfig(CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING);
    if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
    {
        data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
        SendPacket( &data );
        return;
    }

    bool AllowTwoSideAccounts = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER;
    uint32 skipCinematics = sWorld.getConfig(CONFIG_SKIP_CINEMATICS);

    bool have_same_race = false;

    // if 0 then allowed creating without any characters
    bool have_req_level_for_heroic = (req_level_for_heroic==0);

    if(!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT)
    {
        QueryResult *result2 = CharacterDatabase.PQuery("SELECT level,race,class FROM characters WHERE account = '%u' %s",
            GetAccountId(), (skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT) ? "" : "LIMIT 1");
        if(result2)
        {
            uint32 team_= Player::TeamForRace(race_);

            Field* field = result2->Fetch();
            uint8 acc_race  = field[1].GetUInt32();

            if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
            {
                uint8 acc_class = field[2].GetUInt32();
                if(acc_class == CLASS_DEATH_KNIGHT)
                {
                    if(heroic_free_slots > 0)
                        --heroic_free_slots;

                    if(heroic_free_slots == 0)
                    {
                        data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
                        SendPacket( &data );
                        return;
                    }
                }

                if(!have_req_level_for_heroic)
                {
                    uint32 acc_level = field[0].GetUInt32();
                    if(acc_level >= req_level_for_heroic)
                        have_req_level_for_heroic = true;
                }
            }

            // need to check team only for first character
            // TODO: what to if account already has characters of both races?
            if (!AllowTwoSideAccounts)
            {
                uint32 acc_team = 0;
                if(acc_race > 0)
                    acc_team = Player::TeamForRace(acc_race);

                if(acc_team != team_)
                {
                    data << (uint8)CHAR_CREATE_PVP_TEAMS_VIOLATION;
                    SendPacket( &data );
                    delete result2;
                    return;
                }
            }

            // search same race for cinematic or same class if need
            // TODO: check if cinematic already shown? (already logged in?; cinematic field)
            while ((skipCinematics == 1 && !have_same_race) || class_ == CLASS_DEATH_KNIGHT)
            {
                if(!result2->NextRow())
                    break;

                field = result2->Fetch();
                acc_race = field[1].GetUInt32();

                if(!have_same_race)
                    have_same_race = race_ == acc_race;

                if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
                {
                    uint8 acc_class = field[2].GetUInt32();
                    if(acc_class == CLASS_DEATH_KNIGHT)
                    {
                        if(heroic_free_slots > 0)
                            --heroic_free_slots;

                        if(heroic_free_slots == 0)
                        {
                            data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
                            SendPacket( &data );
                            return;
                        }
                    }

                    if(!have_req_level_for_heroic)
                    {
                        uint32 acc_level = field[0].GetUInt32();
                        if(acc_level >= req_level_for_heroic)
                            have_req_level_for_heroic = true;
                    }
                }
            }
            delete result2;
        }
    }

    if(GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic)
    {
        data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
        SendPacket( &data );
        return;
    }

    // extract other data required for player creating
    uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId;
    recv_data >> gender >> skin >> face;
    recv_data >> hairStyle >> hairColor >> facialHair >> outfitId;

    Player *pNewChar = new Player(this);
    if(!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId ))
    {
        // Player not create (race/class problem?)
        delete pNewChar;

        data << (uint8)CHAR_CREATE_ERROR;
        SendPacket( &data );

        return;
    }

    if ((have_same_race && skipCinematics == 1) || skipCinematics == 2)
        pNewChar->setCinematic(1);                          // not show intro

    // Player created, save it now
    pNewChar->SaveToDB();
    charcount += 1;

    loginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%d' AND realmid = '%d'", GetAccountId(), realmID);
    loginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)",  charcount, GetAccountId(), realmID);

    delete pNewChar;                                        // created only to call SaveToDB()

    data << (uint8)CHAR_CREATE_SUCCESS;
    SendPacket( &data );

    std::string IP_str = GetRemoteAddress();
    sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]", GetAccountId(), IP_str.c_str(), name.c_str());
    sLog.outChar("Account: %d (IP: %s) Create Character:[%s]", GetAccountId(), IP_str.c_str(), name.c_str());
}
void WorldSession::HandleCharCreateOpcode(WorldPacket& recv_data)
{
    std::string name;
    uint8 race_, class_;

    recv_data >> name;

    recv_data >> race_;
    recv_data >> class_;

    // extract other data required for player creating
    uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId;
    recv_data >> gender >> skin >> face;
    recv_data >> hairStyle >> hairColor >> facialHair >> outfitId;

    WorldPacket data(SMSG_CHAR_CREATE, 1);                  // returned with diff.values in all cases

    if (GetSecurity() == SEC_PLAYER)
    {
        if (uint32 mask = sWorld.getConfig(CONFIG_UINT32_CHARACTERS_CREATING_DISABLED))
        {
            bool disabled = false;

            Team team = Player::TeamForRace(race_);
            switch (team)
            {
                case ALLIANCE: disabled = (mask & (1 << 0)) != 0; break;
                case HORDE:    disabled = (mask & (1 << 1)) != 0; break;
                default: break;
            }

            if (disabled)
            {
                data << (uint8)CHAR_CREATE_DISABLED;
                SendPacket(data, true);
                return;
            }
        }
    }

    ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
    ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_);

    if (!classEntry || !raceEntry)
    {
        data << (uint8)CHAR_CREATE_FAILED;
        SendPacket(data, true);
        sLog.outError("Class: %u or Race %u not found in DBC (Wrong DBC files?) or Cheater?", class_, race_);
        return;
    }

    // prevent character creating with invalid name
    if (!normalizePlayerName(name))
    {
        data << (uint8)CHAR_NAME_NO_NAME;
        SendPacket(data, true);
        sLog.outError("Account:[%d] but tried to Create character with empty [name]", GetAccountId());
        return;
    }

    // check name limitations
    uint8 res = ObjectMgr::CheckPlayerName(name, true);
    if (res != CHAR_NAME_SUCCESS)
    {
        data << uint8(res);
        SendPacket(data, true);
        return;
    }

    if (GetSecurity() == SEC_PLAYER && sObjectMgr.IsReservedName(name))
    {
        data << (uint8)CHAR_NAME_RESERVED;
        SendPacket(data, true);
        return;
    }

    if (sObjectMgr.GetPlayerGuidByName(name))
    {
        data << (uint8)CHAR_CREATE_NAME_IN_USE;
        SendPacket(data, true);
        return;
    }

    QueryResult* resultacct = LoginDatabase.PQuery("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '%u'", GetAccountId());
    if (resultacct)
    {
        Field* fields = resultacct->Fetch();
        uint32 acctcharcount = fields[0].GetUInt32();
        delete resultacct;

        if (acctcharcount >= sWorld.getConfig(CONFIG_UINT32_CHARACTERS_PER_ACCOUNT))
        {
            data << (uint8)CHAR_CREATE_ACCOUNT_LIMIT;
            SendPacket(data, true);
            return;
        }
    }

    QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%u'", GetAccountId());
    uint8 charcount = 0;
    if (result)
    {
        Field* fields = result->Fetch();
        charcount = fields[0].GetUInt8();
        delete result;

        if (charcount >= sWorld.getConfig(CONFIG_UINT32_CHARACTERS_PER_REALM))
        {
            data << (uint8)CHAR_CREATE_SERVER_LIMIT;
            SendPacket(data, true);
            return;
        }
    }

    bool AllowTwoSideAccounts = !sWorld.IsPvPRealm() || sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER;
    CinematicsSkipMode skipCinematics = CinematicsSkipMode(sWorld.getConfig(CONFIG_UINT32_SKIP_CINEMATICS));

    bool have_same_race = false;
    if (!AllowTwoSideAccounts || skipCinematics == CINEMATICS_SKIP_SAME_RACE)
    {
        QueryResult* result2 = CharacterDatabase.PQuery("SELECT race FROM characters WHERE account = '%u' %s",
                               GetAccountId(), (skipCinematics == CINEMATICS_SKIP_SAME_RACE) ? "" : "LIMIT 1");
        if (result2)
        {
            Team team_ = Player::TeamForRace(race_);

            Field* field = result2->Fetch();
            uint8 acc_race  = field[0].GetUInt32();

            // need to check team only for first character
            // TODO: what to if account already has characters of both races?
            if (!AllowTwoSideAccounts)
            {
                if (acc_race == 0 || Player::TeamForRace(acc_race) != team_)
                {
                    data << (uint8)CHAR_CREATE_PVP_TEAMS_VIOLATION;
                    SendPacket(data, true);
                    delete result2;
                    return;
                }
            }

            // search same race for cinematic or same class if need
            // TODO: check if cinematic already shown? (already logged in?; cinematic field)
            while (skipCinematics == CINEMATICS_SKIP_SAME_RACE && !have_same_race)
            {
                if (!result2->NextRow())
                    break;

                field = result2->Fetch();
                acc_race = field[0].GetUInt32();

                have_same_race = race_ == acc_race;
            }
            delete result2;
        }
    }

    Player* pNewChar = new Player(this);
    if (!pNewChar->Create(sObjectMgr.GeneratePlayerLowGuid(), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId))
    {
        // Player not create (race/class problem?)
        delete pNewChar;

        data << (uint8)CHAR_CREATE_ERROR;
        SendPacket(data, true);

        return;
    }

    if ((have_same_race && skipCinematics == CINEMATICS_SKIP_SAME_RACE) || skipCinematics == CINEMATICS_SKIP_ALL)
        pNewChar->setCinematic(1);                          // not show intro

    pNewChar->SetAtLoginFlag(AT_LOGIN_FIRST);               // First login

    // Player created, save it now
    pNewChar->SaveToDB();
    charcount += 1;

    LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%u' AND realmid = '%u'", GetAccountId(), realmID);
    LoginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)",  charcount, GetAccountId(), realmID);

    data << (uint8)CHAR_CREATE_SUCCESS;
    SendPacket(data, true);

    const std::string& IP_str = GetRemoteAddress();
    BASIC_LOG("Account: %d (IP: %s) Create Character:[%s] (guid: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), pNewChar->GetGUIDLow());
    sLog.outChar("Account: %d (IP: %s) Create Character:[%s] (guid: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), pNewChar->GetGUIDLow());

    delete pNewChar;                                        // created only to call SaveToDB()
}
Example #30
0
void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
{
    CHECK_PACKET_SIZE(recv_data,8+1+8);

    uint8 slotid;
    uint64 lootguid, target_playerguid;

    recv_data >> lootguid >> slotid >> target_playerguid;

    if (!_player->GetGroup() || _player->GetGroup()->GetLooterGuid() != _player->GetGUID())
    {
        _player->SendLootRelease(GetPlayer()->GetLootGUID());
        return;
    }

    Player *target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER));
    if (!target)
        return;

    sLog.outDebug("WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName());

    if (_player->GetLootGUID() != lootguid)
        return;

    if (_player->GetInstanceId() != target->GetInstanceId())
        return;

    Loot *pLoot = NULL;

    if (IS_CREATURE_GUID(GetPlayer()->GetLootGUID()))
    {
        Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
        if (!pCreature)
            return;

        pLoot = &pCreature->loot;
    }
    else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
    {
        GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
        if (!pGO)
            return;

        pLoot = &pGO->loot;
    }

    if (!pLoot)
        return;

    if (slotid > pLoot->items.size())
    {
        sLog.outDebug("AutoLootItem: Player %s might be using a hack! (slot %d, size %d)",GetPlayer()->GetName(), slotid, pLoot->items.size());
        return;
    }

    LootItem& item = pLoot->items[slotid];

    ItemPosCountVec dest;
    uint8 msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count);
    if (msg != EQUIP_ERR_OK)
    {
        target->SendEquipError(msg, NULL, NULL);
        _player->SendEquipError(msg, NULL, NULL);         // send duplicate of error massage to master looter
        return;
    }

    // not move item from loot to target inventory
    Item * newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId);
    target->SendNewItem(newitem, uint32(item.count), false, false, true);

    target->SaveToDB();

    // mark as looted
    item.count=0;

    pLoot->setItemLooted(&item, target);
    pLoot->NotifyItemRemoved(slotid);
    --pLoot->unlootedCount;
}