Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: arcemu-world/CharacterHandler.cpp
- ===================================================================
- --- arcemu-world/CharacterHandler.cpp (revision 4105)
- +++ arcemu-world/CharacterHandler.cpp (working copy)
- @@ -1022,6 +1022,7 @@
- plr->SetName(new_name);
- BlueSystemMessageToPlr(plr, "%s changed your name to '%s'.", m_session->GetPlayer()->GetName(), new_name.c_str());
- plr->SaveToDB(false);
- + sWorld.RecacheForAll(2, pi->guid);
- }
- else
- {
- Index: arcemu-world/Chat.cpp
- ===================================================================
- --- arcemu-world/Chat.cpp (revision 4105)
- +++ arcemu-world/Chat.cpp (working copy)
- @@ -81,6 +81,8 @@
- return _arenaCommandTable;
- else if(!stricmp(name, "achieve"))
- return _achievementCommandTable;
- + else if(!stricmp(name, "recache"))
- + return _recacheCommandTable;
- return 0;
- }
- @@ -216,6 +218,7 @@
- free( _instanceCommandTable );
- free( _arenaCommandTable );
- free( _achievementCommandTable );
- + free( _recacheCommandTable);
- free( _commandTable );
- }
- @@ -680,6 +683,20 @@
- };
- dupe_command_table(achievementCommandTable, _achievementCommandTable);
- + static ChatCommand recacheCommandTable[] =
- + {
- + { "item", 'm', &ChatHandler::HandleRecacheItemCommand, "Recache a item or item range for your current target.", NULL, 0, 0, 0 },
- + { "gobject", 'm', &ChatHandler::HandleRecacheGameObjectCommand, "Recache a gameobject or gameobject range for your current target.", NULL, 0, 0, 0 },
- + { "creature", 'm', &ChatHandler::HandleRecacheCreatureCommand, "Recache a creature or creature range for your current target.", NULL, 0, 0, 0 },
- + { "playername", 'm', &ChatHandler::HandleRecachePlayerNameCommand, "Recache your currents targets name for self.", NULL, 0, 0, 0 },
- + { "itemall", 'm', &ChatHandler::HandleRecacheItemForAllCommand, "Recache an item or item range for everyone online", NULL, 0, 0, 0 },
- + { "gobjectall", 'm', &ChatHandler::HandleRecacheGameObjectForAllCommand, "Recache a gameobject or gameobject range for everyone online", NULL, 0, 0, 0 },
- + { "creatureall", 'm', &ChatHandler::HandleRecacheCreatureForAllCommand, "Recache a creature or creature range for everyone online.", NULL, 0, 0, 0 },
- + { "playernameall", 'm', &ChatHandler::HandleRecachePlayerNameForAllCommand, "Recache your current target's name for everyone online.", NULL, 0, 0, 0 },
- + { NULL, '0', NULL, "", NULL, 0, 0, 0 }
- + };
- + dupe_command_table(recacheCommandTable, _recacheCommandTable);
- +
- static ChatCommand commandTable[] =
- {
- { "commands", '0', &ChatHandler::HandleCommandsCommand, "Shows commands", NULL, 0, 0, 0 },
- @@ -741,6 +758,7 @@
- { "fixscale", 'm', &ChatHandler::HandleFixScaleCommand, "", NULL, 0, 0, 0 },
- { "addtrainerspell", 'm', &ChatHandler::HandleAddTrainerSpellCommand, "", NULL, 0, 0, 0 },
- { "achieve", '0', NULL, "", achievementCommandTable, 0, 0, 0 },
- + { "recache", 'm', NULL, "", recacheCommandTable, 0, 0, 0 },
- { NULL, '0', NULL, "", NULL, 0, 0, 0 }
- };
- dupe_command_table(commandTable, _commandTable);
- Index: arcemu-world/Chat.h
- ===================================================================
- --- arcemu-world/Chat.h (revision 4105)
- +++ arcemu-world/Chat.h (working copy)
- @@ -184,6 +184,7 @@
- ChatCommand* _instanceCommandTable;
- ChatCommand* _arenaCommandTable;
- ChatCommand* _achievementCommandTable;
- + ChatCommand* _recacheCommandTable;
- ChatCommand* _commandTable;
- ChatCommand * GetSubCommandTable(const char * name);
- @@ -596,6 +597,15 @@
- bool HandleCollisionGetHeight(const char * args, WorldSession * m_session);
- bool HandleAccountMuteCommand(const char * args, WorldSession * m_session);
- bool HandleAccountUnmuteCommand(const char * args, WorldSession * m_session);
- + //"Recaching" Commands
- + bool HandleRecacheItemCommand(const char * args, WorldSession * m_session);
- + bool HandleRecacheCreatureCommand(const char * args, WorldSession * m_session);
- + bool HandleRecachePlayerNameCommand(const char * args, WorldSession * m_session);
- + bool HandleRecacheGameObjectCommand(const char * args, WorldSession * m_session);
- + bool HandleRecacheItemForAllCommand(const char * args, WorldSession * m_session);
- + bool HandleRecacheCreatureForAllCommand(const char * args, WorldSession * m_session);
- + bool HandleRecachePlayerNameForAllCommand(const char * args, WorldSession * m_session);
- + bool HandleRecacheGameObjectForAllCommand(const char * args, WorldSession * m_session);
- /* For skill related GM commands */
- SkillNameMgr *SkillNameManager;
- Index: arcemu-world/Level3.cpp
- ===================================================================
- --- arcemu-world/Level3.cpp (revision 4105)
- +++ arcemu-world/Level3.cpp (working copy)
- @@ -1423,12 +1423,6 @@
- bool ChatHandler::HandleDBReloadCommand(const char* args, WorldSession* m_session)
- {
- -
- - sWorld.SendWorldText("Support for reloading tables on the fly was disabled in Arcemu revision 3621. You are seeing this message because apparently reading SVN changelog or using forums search is way over the head of some of our users.", 0 );
- - return true;
- -
- - /*
- -
- char str[200];
- int ret = 0;
- @@ -1440,22 +1434,8 @@
- snprintf(str, 200, "%s%s initiated server-side reload of table `%s`. The server may experience some lag while this occurs.",
- MSG_COLOR_LIGHTRED, m_session->GetPlayer()->GetName(), args);
- sWorld.SendWorldText(str, 0);
- + ret = Storage_ReloadTable(args);
- - if (0 == stricmp(args, "spell_disable"))
- - {
- - objmgr.ReloadDisabledSpells();
- - ret = 1;
- - } else
- - if (0 == stricmp(args, "vendors"))
- - {
- - objmgr.ReloadVendors();
- - ret = 1;
- - }
- - else
- - {
- - ret = Storage_ReloadTable(args);
- - }
- -
- if (ret == 0)
- snprintf(str, 200, "%sDatabase reload failed.", MSG_COLOR_LIGHTRED);
- else
- @@ -1463,9 +1443,6 @@
- sWorld.SendWorldText(str, 0);
- sGMLog.writefromsession(m_session, "reloaded table %s", args);
- return true;
- -
- - */
- -
- }
- bool ChatHandler::HandleModifyLevelCommand(const char* args, WorldSession* m_session)
- @@ -4086,3 +4063,236 @@
- }
- return true;
- }
- +
- +//Recache Commands
- +
- +bool ChatHandler::HandleRecacheItemCommand(const char * args, WorldSession * m_session)
- +{
- + if(!args)
- + return false;
- + Player * p = getSelectedChar(m_session);
- + if(p == NULL)
- + return false;
- + uint32 start = 0;
- + uint32 end = 0;
- + if( sscanf(args, "%u %u", &start, &end) != 2)
- + if(sscanf(args, "%u", &start) != 1)
- + return false;
- + if(end !=0)
- + {
- + if(start > end)
- + return false;
- + if(end - start >= 200) //lets limit this
- + {
- + m_session->SystemMessage("You appear to be trying to 'accidently' the server, would you like some help?");
- + return true;
- + }
- + m_session->SystemMessage("Recaching items %u through %u", start, end);
- + for(start; start != end;)
- + {
- + p->GetSession()->RecacheItemInfo(start);
- + start++;
- + }
- + }
- + else
- + {
- + m_session->SystemMessage("Recaching item %u", start);
- + p->GetSession()->RecacheItemInfo(start);
- + }
- + return true;
- +}
- +
- +bool ChatHandler::HandleRecacheCreatureCommand(const char * args, WorldSession * m_session)
- +{
- + if(!args)
- + return false;
- + Player * p = getSelectedChar(m_session);
- + if(p == NULL)
- + return false;
- + uint32 start = 0;
- + uint32 end = 0;
- + if( sscanf(args, "%u %u", &start, &end) != 2)
- + if(sscanf(args, "%u", &start) != 1)
- + return false;
- + if(end !=0)
- + {
- + if(start > end)
- + return false;
- + if(end - start >= 200) //lets limit this
- + {
- + m_session->SystemMessage("You appear to be trying to 'accidently' yourself, would you like some help?");
- + return true;
- + }
- + m_session->SystemMessage("Recaching creatures %u through %u", start, end);
- + for(start; start != end;)
- + {
- + p->GetSession()->RecacheCreatureInfo(start);
- + start++;
- + }
- + }
- + else
- + {
- + m_session->SystemMessage("Recaching creature %u", start);
- + p->GetSession()->RecacheCreatureInfo(start);
- + }
- + return true;
- +}
- +
- +bool ChatHandler::HandleRecachePlayerNameCommand(const char * args, WorldSession * m_session)
- +{
- + if(!args)
- + return false;
- + Player *p = getSelectedChar(m_session);
- + if(p == NULL)
- + return false;
- + m_session->SystemMessage("Recaching targeted player's name");
- + m_session->RecachePlayerName(p->getPlayerInfo()->guid);
- + return true;
- +}
- +
- +bool ChatHandler::HandleRecacheGameObjectCommand(const char * args, WorldSession * m_session)
- +{
- + if(!args)
- + return false;
- + Player * p = getSelectedChar(m_session);
- + if(p == NULL)
- + return false;
- + uint32 start = 0;
- + uint32 end = 0;
- + if( sscanf(args, "%u %u", &start, &end) != 2)
- + if(sscanf(args, "%u", &start) != 1)
- + return false;
- + if(end !=0)
- + {
- + if(start > end)
- + return false;
- + if(end - start >= 200) //lets limit this
- + {
- + m_session->SystemMessage("You appear to be trying to 'accidently' the server, would you like some help?");
- + return true;
- + }
- + m_session->SystemMessage("Recaching gameobjects %u through %u", start, end);
- + for(start; start != end;)
- + {
- + p->GetSession()->RecacheGameObjectInfo(start);
- + start++;
- + }
- + }
- + else
- + {
- + m_session->SystemMessage("Recaching gameobject %u", start);
- + p->GetSession()->RecacheGameObjectInfo(start);
- + }
- + return true;
- +}
- +
- +bool ChatHandler::HandleRecacheItemForAllCommand(const char * args, WorldSession * m_session)
- +{
- + if(!args)
- + return false;
- + uint32 start = 0;
- + uint32 end = 0;
- + if( sscanf(args, "%u %u", &start, &end) != 2)
- + if(sscanf(args, "%u", &start) != 1)
- + return false;
- + if(end !=0)
- + {
- + if(start > end)
- + return false;
- + if(end - start >= 200) //lets limit this
- + {
- + m_session->SystemMessage("You appear to be trying to 'accidently' the server, would you like some help?");
- + return true;
- + }
- + m_session->SystemMessage("Recaching items %u through %u", start, end);
- + for(start; start != end;)
- + {
- + sWorld.RecacheForAll(1, start);
- + start++;
- + }
- + }
- + else
- + {
- + m_session->SystemMessage("Recaching item %u", start);
- + sWorld.RecacheForAll(1, start);
- + }
- + return true;
- +}
- +
- +bool ChatHandler::HandleRecacheCreatureForAllCommand(const char * args, WorldSession * m_session)
- +{
- + if(!args)
- + return false;
- + uint32 start = 0;
- + uint32 end = 0;
- + if( sscanf(args, "%u %u", &start, &end) != 2)
- + if(sscanf(args, "%u", &start) != 1)
- + return false;
- + if(end !=0)
- + {
- + if(start > end)
- + return false;
- + if(end - start >= 200) //lets limit this
- + {
- + m_session->SystemMessage("You appear to be trying to 'accidently' yourself, would you like some help?");
- + return true;
- + }
- + m_session->SystemMessage("Recaching creatures %u through %u", start, end);
- + for(start; start != end;)
- + {
- + sWorld.RecacheForAll(3, start);
- + start++;
- + }
- + }
- + else
- + {
- + m_session->SystemMessage("Recaching creature %u", start);
- + sWorld.RecacheForAll(3, start);
- + }
- + return true;
- +}
- +
- +bool ChatHandler::HandleRecachePlayerNameForAllCommand(const char * args, WorldSession * m_session)
- +{
- + if(!args)
- + return false;
- + Player *p = getSelectedChar(m_session);
- + if(p == NULL)
- + return false;
- + m_session->SystemMessage("Recaching targeted player's name");
- + sWorld.RecacheForAll(2, p->getPlayerInfo()->guid);
- + return true;
- +}
- +
- +bool ChatHandler::HandleRecacheGameObjectForAllCommand(const char * args, WorldSession * m_session)
- +{
- + if(!args)
- + return false;
- + uint32 start = 0;
- + uint32 end = 0;
- + if( sscanf(args, "%u %u", &start, &end) != 2)
- + if(sscanf(args, "%u", &start) != 1)
- + return false;
- + if(end !=0)
- + {
- + if(start > end)
- + return false;
- + if(end - start >= 200) //lets limit this
- + {
- + m_session->SystemMessage("You appear to be trying to 'accidently' the server, would you like some help?");
- + return true;
- + }
- + m_session->SystemMessage("Recaching gameobjects %u through %u", start, end);
- + for(start; start != end;)
- + {
- + sWorld.RecacheForAll(4, start);
- + start++;
- + }
- + }
- + else
- + {
- + m_session->SystemMessage("Recaching gameobject %u", start);
- + sWorld.RecacheForAll(4, start);
- + }
- + return true;
- +}
- Index: arcemu-world/ObjectStorage.cpp
- ===================================================================
- --- arcemu-world/ObjectStorage.cpp (revision 4105)
- +++ arcemu-world/ObjectStorage.cpp (working copy)
- @@ -626,14 +626,14 @@
- bool Storage_ReloadTable(const char * TableName)
- {
- // bur: mah god this is ugly :P
- - /*if(!stricmp(TableName, "items")) // Items
- + if(!stricmp(TableName, "items")) // Items
- ItemPrototypeStorage.Reload();
- else if(!stricmp(TableName, "creature_proto")) // Creature Proto
- CreatureProtoStorage.Reload();
- else if(!stricmp(TableName, "creature_names")) // Creature Names
- CreatureNameStorage.Reload();
- else if(!stricmp(TableName, "gameobject_names")) // GO Names
- - GameObjectNameStorage.Reload();*/
- + GameObjectNameStorage.Reload();
- if(!stricmp(TableName, "areatriggers")) // Areatriggers
- AreaTriggerStorage.Reload();
- else if(!stricmp(TableName, "itempages")) // Item Pages
- @@ -642,8 +642,8 @@
- WorldStringTableStorage.Reload();
- else if(!stricmp(TableName, "worldbroadcast")) // wb
- WorldBroadCastStorage.Reload();
- - /*else if(!stricmp(TableName, "quests")) // Quests
- - QuestStorage.Reload();*/
- + else if(!stricmp(TableName, "quests")) // Quests
- + QuestStorage.Reload();
- else if(!stricmp(TableName, "npc_text")) // NPC Text Storage
- NpcTextStorage.Reload();
- else if(!stricmp(TableName, "fishing")) // Fishing Zones
- @@ -658,6 +658,10 @@
- ZoneGuardStorage.Reload();
- else if(!stricmp(TableName, "unit_display_sizes"))
- UnitModelSizeStorage.Reload();
- + else if (!(TableName, "spell_disable"))
- + objmgr.ReloadDisabledSpells();
- + else if (!(TableName, "vendors"))
- + objmgr.ReloadVendors();
- else if(!stricmp(TableName, "command_overrides")) // Command Overrides
- {
- CommandTableStorage::getSingleton().Dealloc();
- Index: arcemu-world/SpellHandler.cpp
- ===================================================================
- --- arcemu-world/SpellHandler.cpp (revision 4105)
- +++ arcemu-world/SpellHandler.cpp (working copy)
- @@ -100,15 +100,9 @@
- //
- // Altough this could also happen after a DB update
- // if he/she didn't delete his/her cache.
- - if( found == false ){
- -
- - this->Disconnect();
- - Anticheat_Log->writefromsession( this, "Player tried to use an item with a spell that didn't match the spell in the database." );
- - Anticheat_Log->writefromsession( this, "Possibly corrupted or intentionally altered itemcache.wdb" );
- - Anticheat_Log->writefromsession( this, "Itemid: %lu", itemProto->ItemId );
- - Anticheat_Log->writefromsession( this, "Spellid: %lu", spellId );
- - Anticheat_Log->writefromsession( this, "Player was disconnected" );
- -
- + if( found == false )
- + {
- + RecacheItemInfo(tmpItem->GetEntry());
- return;
- }
- Index: arcemu-world/World.cpp
- ===================================================================
- --- arcemu-world/World.cpp (revision 4105)
- +++ arcemu-world/World.cpp (working copy)
- @@ -2255,4 +2255,38 @@
- data << uint32( areaid );
- SendFactionMessage( &data, team );
- +}
- +
- +void World::RecacheForAll(uint8 type, uint32 arg)
- +{
- + m_sessionlock.AcquireReadLock();
- + SessionMap::iterator itr;
- + for (itr = m_sessions.begin(); itr != m_sessions.end(); itr++)
- + {
- + if (itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
- + {
- + switch(type)
- + {
- + case 1:
- + {
- + itr->second->RecacheItemInfo(arg);
- + }break;
- + case 2:
- + {
- + itr->second->RecachePlayerName((uint64)arg);
- + }break;
- + case 3:
- + {
- + itr->second->RecacheCreatureInfo(arg);
- + }break;
- + case 4:
- + {
- + itr->second->RecacheGameObjectInfo(arg);
- + }break;
- + default:
- + sLog.outError("Unknown recache type %u", type);
- + }
- + }
- + }
- + m_sessionlock.ReleaseReadLock();
- }
- \ No newline at end of file
- Index: arcemu-world/World.h
- ===================================================================
- --- arcemu-world/World.h (revision 4105)
- +++ arcemu-world/World.h (working copy)
- @@ -711,6 +711,8 @@
- static float m_movementCompressThresholdCreatures;
- static uint32 m_movementCompressRate;
- static uint32 m_movementCompressInterval;
- +
- + void RecacheForAll(uint8 type, uint32 arg);
- /*
- * Traffic meter stuff
- */
- Index: arcemu-world/WorldSession.h
- ===================================================================
- --- arcemu-world/WorldSession.h (revision 4105)
- +++ arcemu-world/WorldSession.h (working copy)
- @@ -773,6 +773,48 @@
- float m_wLevel; // Level of water the player is currently in
- bool m_bIsWLevelSet; // Does the m_wLevel variable contain up-to-date information about water level?
- + //"Recaching" Things
- +
- + //Item Entry
- + void RecacheItemInfo(uint32 entry)
- + {
- + WorldPacket data(CMSG_ITEM_QUERY_SINGLE, 4);
- + data << uint32(entry);
- + HandleItemQuerySingleOpcode(data);
- +
- + data.clear();
- + data.Initialize(CMSG_ITEM_QUERY_SINGLE);
- + data.reserve(12);
- + data << uint32(entry) << uint64(0);
- + HandleItemNameQueryOpcode(data);
- + }
- +
- + //Player Low Guid
- + void RecachePlayerName(uint64 guid)
- + {
- + WorldPacket data(CMSG_NAME_QUERY, 8);
- + data << guid;
- + HandleNameQueryOpcode(data);
- + }
- +
- + // Creature Entry
- + void RecacheCreatureInfo(uint32 entry)
- + {
- + WorldPacket data(CMSG_CREATURE_QUERY, 12);
- + data << entry;
- + data << (uint64)1; //Opcode handler doesn't use guid so just send 1
- + HandleCreatureQueryOpcode(data);
- + }
- +
- + // GameObject Entry
- + void RecacheGameObjectInfo(uint32 entry)
- + {
- + WorldPacket data(CMSG_GAMEOBJECT_QUERY, 12);
- + data << entry;
- + data << (uint64)1; //Opcode handler doesn't use guid so just send 1
- + HandleGameObjectQueryOpcode(data);
- + }
- +
- private:
- friend class Player;
- Player *_player;
Advertisement
Add Comment
Please, Sign In to add comment