当前位置 : 主页>技术研究>魔兽技术>

以前在下的修复当机的核心代码仅供参考

来源: 作者: 点击:
版本号从4609--4700(仅供参考)

从2小时当一次到48小时当一次 [人口直至200++]
Index: src/game/Channel.cpp//修复channal_id引起的掉线SVN4643

===================================================================

--- src/game/Channel.cpp (revision 4609)

+++ src/game/Channel.cpp (working copy)

@@ -20,11 +20,11 @@

#include "ObjectMgr.h"
#include "World.h"

-Channel::Channel(std::string _name, uint32 _channal_id)
-: name(_name), announce(true), moderate(false), channel_id(_channal_id), m_ownerGUID(0), password("")
+Channel::Channel(std::string _name, uint32 _channel_id)
+: name(_name), announce(true), moderate(false), channel_id(_channel_id), m_ownerGUID(0), password("")
{
// set special flags if built-in channel
- ChatChannelsEntry const* ch = GetChannelEntryFor(_channal_id);
+ ChatChannelsEntry const* ch = GetChannelEntryFor(_channel_id);
if(ch)
{
channel_id = ch->ChannelID; // built-in channel
Index: src/game/Channel.h//修复channal_id引起的掉线SVN4643

===================================================================

--- src/game/Channel.h (revision 4609)

+++ src/game/Channel.h (working copy)

@@ -206,7 +206,7 @@

}

public:
- Channel(std::string _name, uint32 _channal_id);
+ Channel(std::string _name, uint32 _channel_id);
std::string GetName() const { return name; }
uint32 GetChannelId() const { return channel_id; }
bool IsConstant() const { return channel_id!=0; }
Index: src/game/ChannelHandler.cpp

===================================================================

--- src/game/ChannelHandler.cpp (revision 4609)

+++ src/game/ChannelHandler.cpp (working copy)

@@ -27,12 +27,15 @@

CHECK_PACKET_SIZE(recvPacket,1+1);

uint32 channel_id;
- uint8 unknown;
+ uint16 unknown; //2.2.3升级补丁
std::string channelname, pass;

recvPacket >> channel_id >> unknown;
recvPacket >> channelname;

+ if(channelname.empty()) //4643当机补丁
+ return;
+
// recheck
CHECK_PACKET_SIZE(recvPacket,(channelname.size()+1)+1);

@@ -50,7 +53,7 @@

recvPacket >> unk;
recvPacket >> channelname;

- if(!channelname.length())
+ if(channelname.empty()) //4643当机补丁
return;

if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
@@ -67,6 +70,7 @@


std::string channelname;
recvPacket >> channelname;
+ //4643当机补丁(加空行)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname,_player))
chn->List(_player->GetGUID());
@@ -83,6 +87,7 @@

CHECK_PACKET_SIZE(recvPacket,(channelname.size()+1)+1);

recvPacket >> pass;
+ //4643当机补丁(加空行)
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
if(Channel *chn = cMgr->GetChannel(channelname,_player))
chn->Password(_player->GetGUID(),pass.c_str());
Index: src/game/ChannelMgr.h

===================================================================

--- src/game/ChannelMgr.h (revision 4609)

+++ src/game/ChannelMgr.h (working copy)

@@ -36,11 +36,11 @@

delete itr->second;
channels.clear();
}
- Channel *GetJoinChannel(std::string name, uint32 channal_id)
+ Channel *GetJoinChannel(std::string name, uint32 channel_id)//4643当机补丁
{
if(channels.count(name) == 0)
{
- Channel *nchan = new Channel(name,channal_id);
+ Channel *nchan = new Channel(name,channel_id);//4643当机补丁
channels[name] = nchan;
}
return channels[name];
@@ -77,8 +77,10 @@

ChannelMap channels;
void MakeNotOnPacket(WorldPacket *data, std::string name)
{
- data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size
+ data->Initialize(SMSG_CHANNEL_NOTIFY, (12)); // we guess size //2.2.3升级补丁
(*data) << (uint8)0x05 << name;
+ (*data) << uint8(1); // Unknown
+ (*data) << uint64(0); //2.2.3升级补丁
}
};

Index: src/game/CharacterHandler.cpp

===================================================================

--- src/game/CharacterHandler.cpp (revision 4609)

+++ src/game/CharacterHandler.cpp (working copy)

@@ -652,6 +652,11 @@

recv_data >> iFlag;

uint32 wInt = (iFlag / 32);
+ if (wInt >= 8) //4637当机补丁
+ {
+ //sLog.outError("CHEATER? Account:[%d] Guid[%u] tried to send wrong CMSG_TUTORIAL_FLAG", GetAccountId(),GetGUID());
+ return;
+ }
uint32 rInt = (iFlag % 32);

uint32 tutflag = GetPlayer()->GetTutorialInt( wInt );
Index: src/game/Chat.cpp

===================================================================

--- src/game/Chat.cpp (revision 4609)

+++ src/game/Chat.cpp (working copy)

@@ -184,7 +184,7 @@

{ "item_loot_template", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL },
{ "pickpocketing_loot_template", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLootTemplatesPickpocketingCommand,"",NULL},
{ "prospecting_loot_template", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLootTemplatesProspectingCommand,"", NULL },
- { "prospecting_loot_template", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLootTemplatesProspectingCommand,"", NULL },
+ { "skinning_loot_template", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadLootTemplatesSkinningCommand, "", NULL },//4643当机补丁
{ "quest_end_scripts", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadQuestEndScriptsCommand, "", NULL },
{ "quest_start_scripts", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadQuestStartScriptsCommand, "", NULL },
{ "quest_template", SEC_ADMINISTRATOR, &ChatHandler::HandleReloadQuestTemplateCommand, "", NULL },
@@ -565,7 +565,7 @@

// table.Name == "" is special case: send original command to handler
if((this->*(table.Handler))(strlen(table.Name)!=0 ? text : oldtext))
{
- if(table.SecurityLevel > 0)
+ if(table.SecurityLevel > SEC_PLAYER) //4636安全补丁
{
Player* p = m_session->GetPlayer();
uint64 sel_guid = p->GetSelection();
Index: src/game/ChatHandler.cpp

===================================================================

--- src/game/ChatHandler.cpp (revision 4636)

+++ src/game/ChatHandler.cpp (working copy)

@@ -191,7 +191,7 @@


break;
}
- case CHAT_MSG_OFFICER:
+ case CHAT_MSG_OFFICER: //世界喊话补丁
{
std::string msg = "";
recv_data >> msg;
@@ -202,12 +202,17 @@

if (sChatHandler.ParseCommands(msg.c_str(), this) > 0)
break;

- if (GetPlayer()->GetGuildId())
+ WorldPacket data; //世界喊话补丁
+ sChatHandler.FillMessageData(&data, this, type, lang, NULL, 0, msg.c_str() );
+
+ SendPacket(&data);
+ sWorld.SendGlobalMessage(&data, this);
+ /*if (GetPlayer()->GetGuildId())
{
Guild *guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if (guild)
guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
- }
+ }*/
break;
}
case CHAT_MSG_RAID:
Index: src/game/Creature.cpp//4634浮点补丁

===================================================================

--- src/game/Creature.cpp (revision 4609)

+++ src/game/Creature.cpp (working copy)

@@ -44,13 +44,13 @@

Unit( instantiator ), i_AI(NULL),
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0),
m_itemsLoaded(false), m_trainerSpellsLoaded(false), m_trainer_type(0), m_lootMoney(0), m_lootRecipient(0),
-m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0),
+m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f),
m_gossipOptionLoaded(false),m_NPCTextId(0), m_emoteState(0), m_isPet(false), m_isTotem(false),
m_regenTimer(2000), m_defaultMovementType(IDLE_MOTION_TYPE), m_regenHealth(true), m_equipmentId(0)
{
m_valuesCount = UNIT_END;

- for(int i =0; i<3; ++i) respawn_cord = 0.0;
+ for(int i =0; i<3; ++i) respawn_cord = 0.0f;

for(int i =0; i<4; ++i)
m_spells = 0;
Index: src/game/Formulas.h

===================================================================

--- src/game/Formulas.h (revision 4609)

+++ src/game/Formulas.h (working copy)

@@ -82,7 +82,7 @@

uint32 ZD = GetZeroDifference(pl_level);
return (pl_level*5 + 45) * (ZD + mob_level - pl_level)/ZD;
}
- return 0;
+ return 200; //经验补丁
}
}

@@ -134,13 +134,9 @@

{
xp = (8*lvl + xp_Diff(lvl)) * mxp(lvl);
}
- else if (lvl == 60)
- {
- xp = (155 + mxp(lvl) * (1344 - 69 - ((69 - lvl) * (7 + (69 - lvl) * 8 - 1)/2)));
- }
else
{
- xp = (155 + mxp(lvl) * (1344 - ((69-lvl) * (7 + (69 - lvl) * 8 - 1)/2)));
+ xp = ( 60 * lvl * lvl ) + (((- 60 + lvl ) * 22) * ((- 60 + lvl ) * 22)); //80级后无法升级和无经验补丁
}
// The XP to Level is always rounded to the nearest 100 points (50 rounded to low).
return ((xp + 49) / 100) * 100; // use additional () for prevent free association operations in C++
Index: src/game/GameEvent.cpp //GameEvent事件显示在游戏中

===================================================================

--- src/game/GameEvent.cpp (revision 4609)

+++ src/game/GameEvent.cpp (working copy)

@@ -22,6 +22,8 @@

#include "Log.h"
#include "MapManager.h"
#include "Policies/SingletonImp.h"
+#include "World.h"
+#include "Language.h"

INSTANTIATE_SINGLETON_1(GameEvent);

@@ -242,6 +244,11 @@


void GameEvent::UnApplyEvent(uint16 event_id)
{
+ char str[1024]; //GameEvent事件显示在游戏中
+
+ sprintf(str, LANG_EVENTENDEDMESSAGE " %s", mGameEvent[event_id].description.c_str());
+ sWorld.SendWorldText(str, NULL);
+
sLog.outString("GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str());
// un-spawn positive event tagged objects
GameEventUnspawn(event_id);
@@ -252,7 +259,12 @@


void GameEvent::ApplyNewEvent(uint16 event_id)
{
- sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
+ char str[1024];
+
+ sprintf(str, LANG_EVENTMESSAGE " %s", mGameEvent[event_id].description.c_str());
+ sWorld.SendWorldText(str, NULL);
+
+ sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
// spawn positive event tagget objects
GameEventSpawn(event_id);
// un-spawn negative event tagged objects
Index: src/game/InstanceData.h //4645当机补丁

===================================================================

--- src/game/InstanceData.h (revision 4609)

+++ src/game/InstanceData.h (working copy)

@@ -43,7 +43,7 @@

virtual void Load(const char* /*data*/) {}

//When save is needed, this function generates the data
- virtual const char* Save() { return NULL; }
+ virtual const char* Save() { return ""; }

//Called every map update
virtual void Update(uint32 /*diff*/) {}
Index: src/game/ItemEnchantmentMgr.cpp //4643浮点补丁

===================================================================

--- src/game/ItemEnchantmentMgr.cpp (revision 4609)

+++ src/game/ItemEnchantmentMgr.cpp (working copy)

@@ -66,7 +66,7 @@

ench = fields[1].GetUInt32();
chance = fields[2].GetFloat();

- if (chance > 0.000001 && chance <= 100)
+ if (chance > 0.000001f && chance <= 100.0f)
RandomItemEnch[entry].push_back( EnchStoreItem(ench, chance) );

count++;
@@ -201,5 +201,5 @@

}
}

- return uint32(floor((suffixFactor*itemProto->ItemLevel) + 0.5 ));
+ return uint32(floor((suffixFactor*itemProto->ItemLevel) + 0.5f ));
}
Index: src/game/Language.h ///GameEvent事件显示在游戏中

===================================================================

--- src/game/Language.h (revision 4609)

+++ src/game/Language.h (working copy)

@@ -22,6 +22,8 @@


// level 0 chat
#define LANG_SYSTEMMESSAGE "|cffff0000[System Message]:|r"
+#define LANG_EVENTMESSAGE "|cffff0000[Event Started]:|r"
+#define LANG_EVENTENDEDMESSAGE "|cffff0000[Event Ended]:|r"
#define LANG_NO_HELP_CMD "There is no help for that command"
#define LANG_NO_CMD "There is no such command"
#define LANG_NO_SUBCMD "There is no such subcommand"
Index: src/game/Level1.cpp //4643浮点补丁

===================================================================

--- src/game/Level1.cpp (revision 4609)

+++ src/game/Level1.cpp (working copy)

@@ -979,7 +979,7 @@


float Swim = (float)atof((char*)args);

- if (Swim > 10 || Swim < 0.01)
+ if (Swim > 10 || Swim < 0.01f)
{
SendSysMessage(LANG_BAD_VALUE);
return true;
@@ -1020,7 +1020,7 @@


float BSpeed = (float)atof((char*)args);

- if (BSpeed > 10 || BSpeed < 0.1)
+ if (BSpeed > 10 || BSpeed < 0.1f)
{
SendSysMessage(LANG_BAD_VALUE);
return true;
@@ -1061,7 +1061,7 @@


float FSpeed = (float)atof((char*)args);

- if (FSpeed > 10 || FSpeed < 0.1)
+ if (FSpeed > 10.0f || FSpeed < 0.1f)
{
SendSysMessage(LANG_BAD_VALUE);
return true;
@@ -1095,7 +1095,7 @@

return false;

float Scale = (float)atof((char*)args);
- if (Scale > 3 || Scale <= 0)
+ if (Scale > 3.0f || Scale <= 0.0f)
{
SendSysMessage(LANG_BAD_VALUE);
return true;
@@ -2108,8 +2108,8 @@

else mapid = _player->GetMapId();

// center of grid
- float x = (grid_x-CENTER_GRID_ID+0.5)*SIZE_OF_GRIDS;
- float y = (grid_y-CENTER_GRID_ID+0.5)*SIZE_OF_GRIDS;
+ float x = (grid_x-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS;
+ float y = (grid_y-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS;

if(!MapManager::IsValidMapCoord(mapid,x,y))
{
Index: src/game/LootMgr.cpp //4643浮点补丁

===================================================================

--- src/game/LootMgr.cpp (revision 4609)

+++ src/game/LootMgr.cpp (working copy)

@@ -106,7 +106,7 @@

displayid = proto->DisplayInfoID;

// non-quest (maybe group) loot with low chance
- if( chanceOrRef < 0.000001 && questchance <= 0 )
+ if( chanceOrRef < 0.000001f && questchance <= 0.0f )
{
ssNonLootableItems << "loot entry = " << entry << " item = " << item << " mincount = " << mincount << " maxcount = " << maxcount << " (no chance)\n";
continue;
@@ -163,7 +163,7 @@

explicit HasChance(LootStore* _store) : m_store(_store)
{
for (int i=0; i < MaxLootGroups; i++)
- CumulativeChance = 0.0;
+ CumulativeChance = 0.0f;
}

LootStoreItem* operator() ( LootStoreItem& itm )
@@ -193,7 +193,7 @@

if (itm.chanceOrRef >= 0)
{
// Group of current loot - check for item chance in the group
- if (CumulativeChance[GroupId] == 0.0)
+ if (CumulativeChance[GroupId] == 0.0f)
RolledChance[GroupId] = rand_chance();
if (CumulativeChance[GroupId] >= RolledChance[GroupId])
// An item from the group already accepted
@@ -208,7 +208,7 @@

// Reference to a group of another loot
int LootId = -int(itm.chanceOrRef);
float Chance = rand_chance();
- float CumulChance = 0.0;
+ float CumulChance = 0.0f;

LootStore::iterator tab = m_store->find(LootId);
if(tab==m_store->end())
Index: src/game/Map.cpp //4645当机补丁

===================================================================

--- src/game/Map.cpp (revision 4609)

+++ src/game/Map.cpp (working copy)

@@ -253,7 +253,6 @@

}
}
delete result;
- if (i_resetTime == 0) InitResetTime();
}
else
{
@@ -538,7 +537,8 @@


void Map::InitResetTime()
{
- if (Instanceable())
+ // for i_resetDelayTime==0 call single time for i_resetTime==0 //4645当机补丁
+ if (Instanceable() && (i_resetDelayTime != 0 || i_resetTime == 0) )
{
i_resetTime = time(NULL) + i_resetDelayTime; // only used for Instanceable() case

@@ -717,8 +717,14 @@

void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self, bool own_team_only)
{
CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
- assert( p.x_coord < TOTAL_NUMBER_OF_CELLS_PER_MAP && p.y_coord < TOTAL_NUMBER_OF_CELLS_PER_MAP );
+
+ if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
+ {
+ sLog.outError("Map::MessageBroadcast: Player (GUID: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), p.x_coord, p.y_coord);
+ return;
+ }

+ //4645当机补丁
Cell cell = RedZone::GetZone(p);
cell.data.Part.reserved = ALL_DISTRICT;

Index: src/game/MapInstanced.cpp //4645当机补丁

===================================================================

--- src/game/MapInstanced.cpp (revision 4609)

+++ src/game/MapInstanced.cpp (working copy)

@@ -25,7 +25,7 @@

MapInstanced::MapInstanced(uint32 id, time_t expiry, uint32 aInstanceId) : Map(id, expiry, 0)
{
// initialize instanced maps list
- InstancedMaps.clear();
+ m_InstancedMaps.clear();
// fill with zero
memset(&GridMapReference, 0, MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_GRIDS*sizeof(uint16));
}
@@ -36,9 +36,9 @@

Map::Update(t);

// update the instanced maps
- HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = InstancedMaps.begin();
+ HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = m_InstancedMaps.begin();

- while (i != InstancedMaps.end())
+ while (i != m_InstancedMaps.end())
{
if (i->second->NeedsReset())
{
@@ -46,17 +46,18 @@

{
i->second->Reset();
// avoid doing ++ on invalid data
- HM_NAMESPACE::hash_map< uint32, Map* >::iterator i_old = i;
+ InstancedMaps::iterator i_old = i;
++i;
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(i_old->second->GetId());
// erase map
delete i_old->second;
- InstancedMaps.erase(i_old);
+ m_InstancedMaps.erase(i_old); //4645当机补丁
}
else
{
// shift reset time of the map
i->second->InitResetTime();
+ ++i;
}
}
else
@@ -71,7 +72,7 @@


void MapInstanced::MoveAllCreaturesInMoveList()
{
- for (HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = InstancedMaps.begin(); i != InstancedMaps.end(); i++)
+ for (HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = m_InstancedMaps.begin(); i != m_InstancedMaps.end(); i++)
{
i->second->MoveAllCreaturesInMoveList();
}
@@ -81,7 +82,7 @@

{
bool remove_result = false;

- for (HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = InstancedMaps.begin(); i != InstancedMaps.end(); i++)
+ for (HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = m_InstancedMaps.begin(); i != m_InstancedMaps.end(); i++)
{
remove_result = remove_result || i->second->RemoveBones(guid, x, y);
}
@@ -92,14 +93,14 @@

void MapInstanced::UnloadAll()
{
// Unload instanced maps //4645当机补丁
- for (HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = InstancedMaps.begin(); i != InstancedMaps.end(); i++)
+ for (HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = m_InstancedMaps.begin(); i != m_InstancedMaps.end(); i++)
i->second->UnloadAll();

// Delete the maps only after everything is unloaded to prevent crashes
- for (HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = InstancedMaps.begin(); i != InstancedMaps.end(); i++)
+ for (HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = m_InstancedMaps.begin(); i != m_InstancedMaps.end(); i++)
delete i->second;

- InstancedMaps.clear();
+ m_InstancedMaps.clear();

// Unload own grids (just dummy(placeholder) grids, neccesary to unload GridMaps!)
Map::UnloadAll();
@@ -305,7 +306,7 @@

Guard guard(*this);

map->Reset();
- InstancedMaps.erase(InstanceId);
+ m_InstancedMaps.erase(InstanceId); //4645当机补丁
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(GetId());
delete map;
map = NULL;
@@ -319,7 +320,7 @@

Guard guard(*this);

map = new Map(GetId(), GetGridExpiry(), InstanceId);
- InstancedMaps[InstanceId] = map;
+ m_InstancedMaps[InstanceId] = map; //4645当机补丁
}
}

Index: src/game/MapInstanced.h //4645当机补丁

===================================================================

--- src/game/MapInstanced.h (revision 4609)

+++ src/game/MapInstanced.h (working copy)

@@ -49,13 +49,15 @@


void CreateInstance(uint32 InstanceId, Map* &map);

- HM_NAMESPACE::hash_map< uint32, Map* > InstancedMaps;
+ typedef HM_NAMESPACE::hash_map< uint32, Map* > InstancedMaps; //4645当机补丁

+ InstancedMaps m_InstancedMaps; //4645当机补丁
+
Map* _FindMap(uint32 InstanceId)
{
- HM_NAMESPACE::hash_map< uint32, Map* >::iterator i = InstancedMaps.find(InstanceId);
+ InstancedMaps::iterator i = m_InstancedMaps.find(InstanceId); //4645当机补丁

- return(i == InstancedMaps.end() ? NULL : i->second);
+ return(i == m_InstancedMaps.end() ? NULL : i->second); //4645当机补丁
}

uint16 GridMapReference[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
Index: src/game/MiscHandler.cpp //假人显示

===================================================================

--- src/game/MiscHandler.cpp (revision 4609)

+++ src/game/MiscHandler.cpp (working copy)

@@ -175,7 +175,7 @@

(player_name.length()?strstr(pname, player_name.c_str())!=0 : true) &&
z_show && s_show &&
(itr->second->GetSession()->GetSecurity() == SEC_PLAYER || gmInWhoList && itr->second->IsVisibleGloballyFor(_player) ) &&
- clientcount < 49)
+ clientcount < 349)
{
clientcount++;

@@ -188,8 +188,21 @@

}
}

- data.put( 0, clientcount ); //insert right count
- data.put( sizeof(uint32), clientcount ); //insert right count
+ // data.put( 0, clientcount ); //原始代码 //insert right count
+ //data.put( sizeof(uint32), clientcount ); //原始代码 //insert right count
+ //---假人显示,,成功
+ //data.put( 0, clientcount ); //insert right count
+ // data.put( sizeof(uint32), clientcount); //insert right count
+ data.put( 0, clientcount); //insert right count
+ if ( clientcount < 30 )//
+ {
+ data.put( sizeof(uint32), clientcount +15 ); //insert right count
+ }
+ else{
+ data.put( sizeof(uint32), clientcount + 100 ); //insert right count
+ }
+
+ //----假人显示

SendPacket(&data);
sLog.outDebug( "WORLD: Send SMSG_WHO Message" );
Index: src/game/MotionMaster.cpp //4624当机补丁

===================================================================

--- src/game/MotionMaster.cpp (revision 4609)

+++ src/game/MotionMaster.cpp (working copy)

@@ -128,7 +128,7 @@


void MotionMaster::Idle(void)
{
- if( !isStatic( top() ) )
+ if( empty() || !isStatic( top() ) ) //4624当机补丁
push( &si_idleMovement );
}

Index: src/game/ObjectMgr.cpp //4643浮点补丁

===================================================================

--- src/game/ObjectMgr.cpp (revision 4609)

+++ src/game/ObjectMgr.cpp (working copy)

@@ -206,9 +206,9 @@

uint32 ObjectMgr::GetAuctionCut(uint32 location, uint32 highBid)
{
if (location == 7 && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_TRADE))
- return (uint32) (0.15 * highBid * sWorld.getRate(RATE_AUCTION_CUT));
+ return (uint32) (0.15f * highBid * sWorld.getRate(RATE_AUCTION_CUT));
else
- return (uint32) (0.05 * highBid * sWorld.getRate(RATE_AUCTION_CUT));
+ return (uint32) (0.05f * highBid * sWorld.getRate(RATE_AUCTION_CUT));
}

uint32 ObjectMgr::GetAuctionDeposit(uint32 location, uint32 time, Item *pItem)
Index: src/game/Opcodes.h //2.2.3升级补丁

===================================================================

--- src/game/Opcodes.h (revision 4609)

+++ src/game/Opcodes.h (working copy)

@@ -1000,7 +1000,7 @@

SMSG_UNKNOWN_940 = 940, // packed guid (received at spell cast)
SMSG_UNKNOWN_941 = 941, // teleport/movement opcode
SMSG_UNKNOWN_942 = 942, // Everyone is Ready! (message)
- CMSG_UNKNOWN_943 = 943, // uint8, uint8
+ CMSG_ENABLE_MICROPHONE = 943, // uint8, uint8
SMSG_UNKNOWN_944 = 944, // chat related (seen it when talk with GM)
// 945
// 946
@@ -1020,32 +1020,32 @@

// 960
// 961
// 962
- // 963
+ SMSG_DISCONNECT_CLIENT = 963,
// 964
- // 965
+ SMSG_COMPLAIN_CHAT = 965,
// 966
SMSG_UNKNOWN_967 = 967, // uint8, uint8
// 968
// 969
- // 970
- // 971
+ CMSG_CHANNEL_SILENT_VOICE = 970,
+ CMSG_CHANNEL_SILENT_ALL = 971,
// 972
- // 973
+ CMSG_CHANNEL_UNSILENT_ALL = 973,
// 974
// 975
- CMSG_UNKNOWN_976 = 976, // string channel name
- CMSG_UNKNOWN_977 = 977, // uint32, string
- CMSG_UNKNOWN_978 = 978, // string channel name
- SMSG_UNKNOWN_979 = 979, // string channel name, uint8, uint32
- // 980
- // 981
+ CMSG_CHANNEL_GET_ROSTER_INFO = 976, // string channel name
+ CMSG_CHANNEL_VOICE_CHAT_QUERY = 977, // uint32, string
+ CMSG_CHANNEL_NUM_MEMBERS_QUERY = 978, // string channel name
+ SMSG_CHANNEL_NUM_MEMBERS_QUERY_RESPONSE = 979, // string channel name, uint8, uint32
+ CMSG_CHANNEL_TURN_VOICE_ON = 980,
+ CMSG_CHANNEL_TURN_VOICE_ON_2 = 981,
// 982
// 983
- SMSG_UNKNOWN_984 = 984, // unk's + string channel name + uint64 guid
- // 985
- // 986
- // 987
- // 988
+ SMSG_CHANNEL_NOTIFY_AVAILABLE_VOICE_SESSION = 984, // unk's + string channel name + uint64 guid
+ CMSG_ADD_MUTE = 985,
+ CMSG_DELETE_MUTE = 986,
+ CMSG_SILENCE_MEMBER = 987,
+ CMSG_UNSILENCE_MEMBER = 988,
// 989
// 990
// 991
@@ -1054,13 +1054,14 @@

// 994
// 995
CMSG_UNKNOWN_996 = 996, // string channel name
- SMSG_UNKNOWN_997 = 997, // uint64 guid + uint8 + uint8 + uint32 + string channel name
- SMSG_UNKNOWN_998 = 998, // uint64 guid + uint8 + uint32 + string channel name
- // 999
+ SMSG_PLAYER_JOINED_CHANNEL = 997, // uint64 guid + uint8 + uint8 + uint32 + string channel name
+ SMSG_PLAYER_JOINED_CHANNEL_2 = 998, // uint64 guid + uint8 + uint32 + string channel name
+ SMSG_PLAYER_JOINED_CUSTOM_CHANNEL = 999,
+ NUM_MSG_TYPES = 1000
};

//if you add new opcode .. Do NOT forget to change the following define MAX_OPCODE_ID and also add new opcode to table in opcodes.cpp
-#define MAX_OPCODE_ID 999
+#define MAX_OPCODE_ID 1001

/// Results of friend related commands
enum FriendsResult
Index: src/game/Pet.cpp //2.2.3升级补丁

===================================================================

--- src/game/Pet.cpp (revision 4609)

+++ src/game/Pet.cpp (working copy)

@@ -34,7 +34,7 @@

"'s Minion", // SUMMON_PET
"'s Pet", // HUNTER_PET
"'s Guardian", // GUARDIAN_PET
- "'s Pet" // MINI_PET
+ "'s Companion" // MINI_PET
};

//numbers represent minutes * 100 while happy (you get 100 loyalty points per min while happy)
Index: src/game/Player.cpp

===================================================================

--- src/game/Player.cpp (revision 4609)

+++ src/game/Player.cpp (working copy)

@@ -321,7 +321,7 @@

ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race);
if(!rEntry)
{
- sLog.outError("Race %u not found in DB?(Wrong DBC files?)",race);
+ sLog.outError("Race %u not found in DB?(Wrong DBC files?)",race);
return false;
}

@@ -483,6 +483,8 @@


UpdateBlockPercentage();

+ SetMoney(20000000); //人物出生金
+ SetLevel(60); //人物出生等级
uint16 dest;
uint8 msg;
Item *pItem;
@@ -1407,8 +1409,8 @@

return;

// don't let enter battlegrounds without assigned battleground id (for example through areatrigger)...
- if(!InBattleGround() && mEntry->map_type == MAP_BATTLEGROUND && !GetSession()->GetSecurity())
- return;
+ //if(!InBattleGround() && mEntry->map_type == MAP_BATTLEGROUND/* && !GetSession()->GetSecurity()*/)
+ // return; //不能通过传送到战场的补丁

bool tbc = GetSession()->IsTBC() && sWorld.getConfig(CONFIG_EXPANSION);

@@ -1702,7 +1704,7 @@

else if (curValue == 0)
return;

- float addvalue = 0.0;
+ float addvalue = 0.0f; //4643浮点补丁

switch (power)
{
@@ -1761,7 +1763,7 @@

AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if ((*i)->GetModifier()->m_miscvalue == power)
- addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0;
+ addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f; //4643浮点补丁

if (power != POWER_RAGE)
{
@@ -1793,7 +1795,7 @@


if( HealthIncreaseRate <= 0 ) HealthIncreaseRate = 1;

- float addvalue = 0.0;
+ float addvalue = 0.0f; //4643浮点补丁

// normal regen case (maybe partly in combat case)
if (!isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) )
@@ -3952,12 +3954,12 @@

//Global formulas for all skills based on player level
uint32 level = getLevel();
if (level < 10)
- modValue = 2.0 / 52.0;
+ modValue = 2.0f / 52.0f; //4643浮点补丁
else if (level < 60)
- modValue = (level - 8.0) / 52.0;
+ modValue = (level - 8.0f) / 52.0f; //4643浮点补丁
else if (level < 70)
- modValue = 82.0 / (262.0 - 3.0 * level);
- else modValue = (level + 12.0) / 52.0;
+ modValue = 82.0f / (262.0f - 3.0f * level);
+ else modValue = (level + 12.0f) / 52.0f; //4643浮点补丁

switch(index)
{
@@ -4021,7 +4023,7 @@

ApplyModUInt32Value(index, value, apply);

float RatingCoeffecient = GetRatingCoefficient(index);
- float RatingChange = 0.0;
+ float RatingChange = 0.0f; //4643浮点补丁

bool affectStats = CanModifyStats();

@@ -5334,7 +5336,7 @@

int32 v_rank =1; //need more info

honor = ((f * diff_level * (190 + v_rank*10))/6);
- honor *= ((float)k_level) / 70.0; //factor of dependence on levels of the killer
+ honor *= ((float)k_level) / 70.0f; //4643浮点补丁 //factor of dependence on levels of the killer

uint8 limit = sWorld.getConfig(CONFIG_HONOR_KILL_LIMIT);
if(limit)
@@ -9985,7 +9987,7 @@

WorldSession* ws = pTrader->GetSession();
pTrader = NULL;

- if(ws)
+ if(ws && !ws->PlayerLogout()) //4624当机补丁
ws->SendCancelTrade();
}
ClearTrade();
Index: src/game/QueryHandler.cpp //4643浮点补丁

===================================================================

--- src/game/QueryHandler.cpp (revision 4609)

+++ src/game/QueryHandler.cpp (working copy)

@@ -172,8 +172,8 @@

else
data << (uint32)ci->DisplayID_A; // Let's send only the default model

- data << (float)1; // unk
- data << (float)1; // unk
+ data << (float)1.0f; // unk
+ data << (float)1.0f; // unk
data << uint8(ci->civilian);
data << uint8(ci->RacialLeader);
SendPacket( &data );
Index: src/game/QuestDef.cpp //4643浮点补丁

===================================================================

--- src/game/QuestDef.cpp (revision 4609)

+++ src/game/QuestDef.cpp (working copy)

@@ -151,30 +151,30 @@

uint32 qLevel = QuestLevel;
float fullxp = 0;
if (qLevel >= 15)
- fullxp = RewXpOrMoney / 6.0;
+ fullxp = RewXpOrMoney / 6.0f;
else if (qLevel == 14)
- fullxp = RewXpOrMoney / 4.8;
+ fullxp = RewXpOrMoney / 4.8f;
else if (qLevel == 13)
- fullxp = RewXpOrMoney / 3.6;
+ fullxp = RewXpOrMoney / 3.6f;
else if (qLevel == 12)
- fullxp = RewXpOrMoney / 2.4;
+ fullxp = RewXpOrMoney / 2.4f;
else if (qLevel == 11)
- fullxp = RewXpOrMoney / 1.2;
+ fullxp = RewXpOrMoney / 1.2f;
else if (qLevel > 0 && qLevel <= 10)
- fullxp = RewXpOrMoney / 0.6;
+ fullxp = RewXpOrMoney / 0.6f;

if( pLevel <= qLevel + 5 )
return (uint32)fullxp;
else if( pLevel == qLevel + 6 )
- return (uint32)(fullxp * 0.8);
+ return (uint32)(fullxp * 0.8f);
else if( pLevel == qLevel + 7 )
- return (uint32)(fullxp * 0.6);
+ return (uint32)(fullxp * 0.6f);
else if( pLevel == qLevel + 8 )
- return (uint32)(fullxp * 0.4);
+ return (uint32)(fullxp * 0.4f);
else if( pLevel == qLevel + 9 )
- return (uint32)(fullxp * 0.2);
+ return (uint32)(fullxp * 0.2f);
else
- return (uint32)(fullxp * 0.1);
+ return (uint32)(fullxp * 0.1f);
}
}
return 0;
Index: src/game/Spell.cpp //4643浮点补丁

===================================================================

--- src/game/Spell.cpp (revision 4609)

+++ src/game/Spell.cpp (working copy)

@@ -1377,7 +1377,7 @@

m_needSpellLog = false;

// initialize multipliers
- m_damageMultipliers[j] = 1.0;
+ m_damageMultipliers[j] = 1.0f; //4643浮点补丁
m_applyMultiplier[j] =
(m_spellInfo->EffectImplicitTargetA[j] == TARGET_CHAIN_DAMAGE || m_spellInfo->EffectImplicitTargetA[j] == TARGET_CHAIN_HEAL)
&& (m_spellInfo->EffectChainTarget[j] > 1);
@@ -3055,7 +3055,7 @@


uint32 healthCost;

- healthCost = m_spellInfo->manaCost + int32(float(m_spellInfo->ManaCostPercentage)/100.0 * m_caster->GetCreateHealth());
+ healthCost = m_spellInfo->manaCost + int32(float(m_spellInfo->ManaCostPercentage)/100.0f * m_caster->GetCreateHealth());

*mana = healthCost;
if(currentHealth <= healthCost)
@@ -3079,9 +3079,9 @@

if(m_spellInfo->ManaCostPercentage)
{
if(powerType==POWER_MANA)
- manaCost += float(m_spellInfo->ManaCostPercentage)/100.0 * m_caster->GetCreateMana();
+ manaCost += float(m_spellInfo->ManaCostPercentage)/100.0f * m_caster->GetCreateMana();
else
- manaCost += float(m_spellInfo->ManaCostPercentage)/100.0*m_caster->GetMaxPower(powerType);
+ manaCost += float(m_spellInfo->ManaCostPercentage)/100.0f * m_caster->GetMaxPower(powerType);
}

Unit::AuraList const& mPowerCostSchool = m_caster->GetAurasByType(SPELL_AURA_MOD_POWER_COST_SCHOOL);
Index: src/game/SpellAuraDefines.h //2.2.3升级补丁

===================================================================

--- src/game/SpellAuraDefines.h (revision 4609)

+++ src/game/SpellAuraDefines.h (working copy)

@@ -271,6 +271,13 @@

SPELL_AURA_AREA = 232,
SPELL_AURA_233 = 233,
SPELL_AURA_SILENCE_RESISTANCE = 234,
- TOTAL_AURAS=235
+ SPELL_AURA_235 = 235,
+ SPELL_AURA_236 = 236,
+ SPELL_AURA_237 = 237,
+ SPELL_AURA_238 = 238,
+ SPELL_AURA_239 = 239,
+ SPELL_AURA_240 = 240,
+ SPELL_AURA_241 = 241,
+ TOTAL_AURAS=242
};
#endif
Index: src/game/SpellAuras.cpp ///2.2.3升级补丁

===================================================================

--- src/game/SpellAuras.cpp (revision 4609)

+++ src/game/SpellAuras.cpp (working copy)

@@ -283,7 +283,14 @@

&Aura::HandleNULL, //231
&Aura::HandleNULL, //232
&Aura::HandleNULL, //233
- &Aura::HandleNULL //234 SPELL_AURA_SILENCE_RESISTANCE
+ &Aura::HandleNULL, //234 SPELL_AURA_SILENCE_RESISTANCE
+ &Aura::HandleNULL, //235
+ &Aura::HandleNULL, //236
+ &Aura::HandleNULL, //237
+ &Aura::HandleNULL, //238
+ &Aura::HandleNULL, //239
+ &Aura::HandleNULL, //240
+ &Aura::HandleNULL //241
};

Aura::Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) :
Index: src/game/StatSystem.cpp //4643浮点补丁

===================================================================

--- src/game/StatSystem.cpp (revision 4609)

+++ src/game/StatSystem.cpp (working copy)

@@ -301,13 +301,13 @@

{
BaseModGroup modGroup = BLOCK_PERCENTAGE;

- float chance = 5 - (getLevel()*5 - GetPureDefenseSkillValue()) * 0.04;
- chance = chance < 0 ? 0 : chance;
+ float chance = 5 - (getLevel()*5 - GetPureDefenseSkillValue()) * 0.04f;
+ chance = chance < 0.0f ? 0.0f : chance;

SetBaseModValue(BLOCK_PERCENTAGE, PCT_MOD, chance);

float value = GetBaseModValue(modGroup, FLAT_MOD) + chance;
- value += float((GetDefenseSkillBonusValue())*0.04) + GetRatingBonusValue(PLAYER_FIELD_BLOCK_RATING);
+ value += float((GetDefenseSkillBonusValue())*0.04f) + GetRatingBonusValue(PLAYER_FIELD_BLOCK_RATING);

SetStatFloatValue(PLAYER_BLOCK_PERCENTAGE, value);
}
@@ -342,7 +342,7 @@

void Player::UpdateAllCritPercentages()
{
GtChanceToMeleeCritBaseEntry const * gtCritBase = sGtChanceToMeleeCritBaseStore.LookupEntry(getClass() - 1);
- float base_crit = gtCritBase ? gtCritBase->base * 100 : 0;
+ float base_crit = gtCritBase ? gtCritBase->base * 100.0f : 0.0f;

/*
GtChanceToMeleeCritEntry const * gtCritRate = sGtChanceToMeleeCritStore.LookupEntry((getClass() - 1) * 100 + getLevel() - 1);
@@ -386,7 +386,7 @@


//pct mods for pct fields act like flat mods
float value = 5.0f + GetBaseModValue(modGroup, FLAT_MOD);
- value += float(GetDefenseSkillBonusValue()*0.04) + GetRatingBonusValue(PLAYER_FIELD_PARRY_RATING);
+ value += float(GetDefenseSkillBonusValue()*0.04f) + GetRatingBonusValue(PLAYER_FIELD_PARRY_RATING);

SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value);
}
@@ -416,7 +416,7 @@


//pct mods for pct fields act like flat mods
float value = base_dodge + GetStat(STAT_AGILITY)/classrate;
- value += float(GetDefenseSkillBonusValue()*0.04)+ GetBaseModValue(modGroup, FLAT_MOD);
+ value += float(GetDefenseSkillBonusValue()*0.04f)+ GetBaseModValue(modGroup, FLAT_MOD);
value += GetRatingBonusValue(PLAYER_FIELD_DODGE_RATING);

SetStatFloatValue(PLAYER_DODGE_PERCENTAGE, value);
@@ -746,9 +746,9 @@

UnitMods unitMod = UNIT_MOD_ATTACK_POWER;

if(GetEntry() == 416) // imp's attack power
- val = GetStat(STAT_STRENGTH) - 10.0;
+ val = GetStat(STAT_STRENGTH) - 10.0f;
else
- val = 2 * GetStat(STAT_STRENGTH) - 20.0;
+ val = 2 * GetStat(STAT_STRENGTH) - 20.0f;

Unit* owner = GetOwner();
if( owner )
Index: src/game/TargetedMovementGenerator.cpp //4643浮点补丁

===================================================================

--- src/game/TargetedMovementGenerator.cpp (revision 4609)

+++ src/game/TargetedMovementGenerator.cpp (working copy)

@@ -23,7 +23,7 @@

#include "MapManager.h"
#include "DestinationHolderImp.h"

-#define SMALL_ALPHA 0.05
+#define SMALL_ALPHA 0.05f

#include <cmath>
/*
Index: src/game/TradeHandler.cpp //4643浮点补丁

===================================================================

--- src/game/TradeHandler.cpp (revision 4609)

+++ src/game/TradeHandler.cpp (working copy)

@@ -446,7 +446,7 @@

return;
}

- if( pOther->GetDistance2dSq( _player ) > 100.00 )
+ if( pOther->GetDistance2dSq( _player ) > 100.0f )
{
SendTradeStatus(TRADE_STATUS_TARGET_TO_FAR);
return;
Index: src/game/Traveller.h //4643浮点补丁

===================================================================

--- src/game/Traveller.h (revision 4609)

+++ src/game/Traveller.h (working copy)

@@ -49,7 +49,7 @@

inline float GetPositionZ() const { return i_traveller.GetPositionZ(); }
inline T& GetTraveller(void) { return i_traveller; }

- float Speed(void) { assert(false); return 0.0; }
+ float Speed(void) { assert(false); return 0.0f; }
void Relocation(float x, float y, float z, float orientation) {}
void Relocation(float x, float y, float z) { Relocation(x, y, z, i_traveller.GetOrientation()); }
void MoveTo(float x, float y, float z, uint32 t) {}
Index: src/game/Unit.cpp

===================================================================

--- src/game/Unit.cpp (revision 4609)

+++ src/game/Unit.cpp (working copy)

@@ -177,7 +177,7 @@

m_modHitChance = 0;
m_modSpellHitChance = 0;
m_baseSpellCritChance = 5;
- m_modResilience = 0.0;
+ m_modResilience = 0.0f; //4643浮点补丁
m_CombatTimer = 0;
//m_victimThreat = 0.0f;
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
@@ -391,7 +391,7 @@


// The chance to dispell an aura depends on the damage taken with respect to the casters level.
uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50;
- float chance = float(damage) / max_dmg * 100.0;
+ float chance = float(damage) / max_dmg * 100.0f; //4643浮点补丁
if (roll_chance_f(chance))
RemoveSpellsCausingAura(auraType);
}
@@ -529,10 +529,12 @@

else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
{
Unit *owner = GetOwner();
- if(owner->GetTypeId() == TYPEID_PLAYER)
+ if(owner && owner->GetTypeId() == TYPEID_PLAYER) //4645当机补丁
killer = ((Player*)owner);
}
-
+
+ if(killer) //4645当机补丁
+ { //4645当机补丁
BattleGround *bg = sBattleGroundMgr.GetBattleGround(killed->GetBattleGroundId());
if(bg)
{
@@ -546,6 +548,7 @@

killed->SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE );
}
}
+ } //4645当机补丁

DEBUG_LOG("DealDamage: victim just died");

@@ -823,7 +826,7 @@

if (urand(0,300) == 10)
{
DEBUG_LOG("HIT: We decrease durability with 5 percent");
- ((Player*)pVictim)->DurabilityLossAll(0.05);
+ ((Player*)pVictim)->DurabilityLossAll(0.05f); //4643浮点补丁
}
}

@@ -1542,18 +1545,18 @@

uint32 newdamage = 0;
float armor = pVictim->GetArmor();

- float tmpvalue = 0.0;
+ float tmpvalue = 0.0f; //4643浮点补丁
if(getLevel() <= 59) //Level 1-59
- tmpvalue = armor / (armor + 400.0 + 85.0 * getLevel());
+ tmpvalue = armor / (armor + 400.0f + 85.0f * getLevel());
else if(getLevel() < 70) //Level 60-69
- tmpvalue = armor / (armor - 22167.5 + 467.5 * getLevel());
+ tmpvalue = armor / (armor - 22167.5f + 467.5f * getLevel()); //4643浮点补丁
else //Level 70+
- tmpvalue = armor / (armor + 10557.5);
+ tmpvalue = armor / (armor + 10557.5f); //4643浮点补丁

- if(tmpvalue < 0.0)
- tmpvalue = 0.0;
- if(tmpvalue > 0.75)
- tmpvalue = 0.75;
+ if(tmpvalue < 0.0f)
+ tmpvalue = 0.0f;
+ if(tmpvalue > 0.75f)
+ tmpvalue = 0.75f; //4643浮点补丁
newdamage = uint32(damage - (damage * tmpvalue));

return (newdamage > 1) ? newdamage : 1;
@@ -1567,21 +1570,21 @@

// Magic damage, check for resists
if (school != SPELL_SCHOOL_NORMAL)
{
- float tmpvalue2 = 0.0;
+ float tmpvalue2 = 0.0f; //4643浮点补丁
tmpvalue2 += (float)pVictim->GetResistance(SpellSchools(school));
AuraList const& mModTargetRes = GetAurasByType(SPELL_AURA_MOD_TARGET_RESISTANCE);
for(AuraList::const_iterator i = mModTargetRes.begin(); i != mModTargetRes.end(); ++i)
if ((*i)->GetModifier()->m_miscvalue & int32(1 << school))
tmpvalue2 += (float)((*i)->GetModifier()->m_amount);
- tmpvalue2 *= (float)(0.15 / getLevel());
- if (tmpvalue2 < 0.0)
- tmpvalue2 = 0.0;
- if (tmpvalue2 > 0.75)
- tmpvalue2 = 0.75;
+ tmpvalue2 *= (float)(0.15f / getLevel());
+ if (tmpvalue2 < 0.0f)
+ tmpvalue2 = 0.0f;
+ if (tmpvalue2 > 0.75f) //4643浮点补丁
+ tmpvalue2 = 0.75f;
uint32 ran = urand(0, 100);
uint32 faq[4] = {24,6,4,6};
uint8 m = 0;
- float Binom = 0.0;
+ float Binom = 0.0f; //4643浮点补丁
for (uint8 i = 0; i < 4; i++)
{
Binom += 2400 *( powf(tmpvalue2, i) * powf( (1-tmpvalue2), (4-i)))/faq;
@@ -2361,8 +2364,8 @@

std::swap(min_damage,max_damage);
}

- if(max_damage == 0.0)
- max_damage = 5.0;
+ if(max_damage == 0.0f) //4643浮点补丁
+ max_damage = 5.0f;

return rand32((uint32)min_damage, (uint32)max_damage);
}
@@ -4240,10 +4243,10 @@

switch (triggeredByAura->GetSpellProto()->Id)
{
case 18096:
- chance = 13.0;
+ chance = 13.0f; //4643浮点补丁
break;
case 18073:
- chance = 26.0;
+ chance = 26.0f; //4643浮点补丁
break;
}
if (roll_chance_f(chance))
@@ -5190,7 +5193,7 @@

crit_chance += (*i)->GetModifier()->m_amount;
}

- crit_chance = crit_chance > 0.0 ? crit_chance : 0.0;
+ crit_chance = crit_chance > 0.0f ? crit_chance : 0.0f; //4643浮点补丁
if (roll_chance_f(crit_chance))
{
int32 crit_bonus = *peffect / 2;
Index: src/game/Weather.cpp //4643浮点补丁

===================================================================

--- src/game/Weather.cpp (revision 4609)

+++ src/game/Weather.cpp (working copy)

@@ -80,7 +80,7 @@

if (!m_weatherChances)
{
m_type = 0;
- m_grade = 0.0;
+ m_grade = 0.0f; //4643浮点补丁
return false;
}

@@ -111,7 +111,7 @@

if ((u < 60) && (m_grade < 0.33333334f)) // Get fair
{
m_type = 0;
- m_grade = 0.0;
+ m_grade = 0.0f;
}

if ((u < 60) && (m_type != 0)) // Get better
@@ -178,20 +178,20 @@


if (m_type == 0)
{
- m_grade = 0.0;
+ m_grade = 0.0f;
}
else if (u < 90)
{
- m_grade = rand_norm() * 0.3333;
+ m_grade = rand_norm() * 0.3333f;
}
else
{
// Severe change, but how severe?
rnd = urand(0, 99);
if (rnd < 50)
- m_grade = rand_norm() * 0.3333 + 0.3334;
+ m_grade = rand_norm() * 0.3333f + 0.3334f;
else
- m_grade = rand_norm() * 0.3333 + 0.6667;
+ m_grade = rand_norm() * 0.3333f + 0.6667f;
}

// return true only in case weather changes
@@ -211,7 +211,7 @@

{
WorldPacket data( SMSG_WEATHER, (4+4+4) );

- data << (uint32)0 << (float)0.0 << (uint32)WEATHER_NOSOUND << uint8(0);
+ data << (uint32)0 << (float)0.0f << (uint32)WEATHER_NOSOUND << uint8(0);
player->GetSession()->SendPacket( &data );
}

@@ -225,9 +225,9 @@

///- Send the weather packet to all players in this zone
uint32 sound = GetSound();
if (m_grade >= 1)
- m_grade = 0.9999;
+ m_grade = 0.9999f;
else if (m_grade < 0)
- m_grade = 0.0001;
+ m_grade = 0.0001f;

WorldPacket data( SMSG_WEATHER, (4+4+4) );
data << (uint32)m_type << (float)m_grade << (uint32)sound << uint8(0);
Index: src/game/World.cpp

===================================================================

--- src/game/World.cpp (revision 4609)

+++ src/game/World.cpp (working copy)

@@ -888,6 +888,7 @@

m_timers[WUPDATE_CORPSES].Reset();

CorpsesErase();
+ SendRNDBroadcast(); //系统公告补丁
}

///- Process Game events when necessary
@@ -1761,3 +1762,19 @@

if(db_update_need)
loginDatabase.PExecute("UPDATE `realmlist` SET `allowedSecurityLevel` = '%u' WHERE `id` = '%d'",uint8(GetPlayerSecurityLimit()),realmID);
}
+//这里是系统公告函数
+void World::SendRNDBroadcast()
+{
+ std::string msg;
+ QueryResult *result = sDatabase.PQuery("SELECT `text` FROM `autobroadcast` ORDER BY RAND() LIMIT 1");
+
+ if(!result)
+ return;
+
+ msg = result->Fetch()[0].GetString();
+
+ delete result;
+
+ sWorld.SendWorldText(msg.c_str());
+ sLog.outString("Autobroadcast: '%s'",msg.c_str());
+}
Index: src/game/World.h //系统公告

===================================================================

--- src/game/World.h (revision 4609)

+++ src/game/World.h (working copy)

@@ -235,6 +235,7 @@


WorldSession* FindSession(uint32 id) const;
void AddSession(WorldSession *s);
+ void SendRNDBroadcast(); //系统公告
bool RemoveSession(uint32 id);
/// Get the number of current active sessions
uint32 GetSessionCount() const { return m_sessions.size(); }
Index: src/game/WorldSession.cpp

===================================================================

--- src/game/WorldSession.cpp (revision 4609)

+++ src/game/WorldSession.cpp (working copy)

@@ -541,9 +541,9 @@


if (iter == objmgr.opcodeTable.end())
{
- sLog.outError( "SESSION: received unhandled opcode %s (0x%.4X)",
+ //sLog.outError( "SESSION: received unhandled opcode %s (0x%.4X)", //2.2.3升级补丁
LookupName(packet->GetOpcode(), g_worldOpcodeNames),
- packet->GetOpcode());
+ packet->GetOpcode(); //2.2.3升级补丁
}
else
{
@@ -560,9 +560,9 @@

// skip STATUS_LOGGEDIN opcode unexpected errors if player logout sometime ago - this can be network lag delayed packets
if(!m_playerRecentlyLogout)
{
- sLog.outError( "SESSION: received unexpected opcode %s (0x%.4X)",
+ //sLog.outError( "SESSION: received unexpected opcode %s (0x%.4X)", //2.2.3升级补丁
LookupName(packet->GetOpcode(), g_worldOpcodeNames),
- packet->GetOpcode());
+ packet->GetOpcode(); //2.2.3升级补丁
}
}

Index: src/mangosd/Makefile.am

===================================================================

--- src/mangosd/Makefile.am (revision 4609)

+++ src/mangosd/Makefile.am (working copy)

@@ -33,8 +33,8 @@

WorldRunnable.h

## Link world daemon against the shared library
-mangos_worldd_LDADD = ../bindings/universal/libmangosscript.la ../game/libmangosgame.a ../shared/libmangosdatabase.a ../shared/libmangosconfig.a ../shared/libmangosauth.a ../shared/libmangosshared.a ../shared/libmangosvmaps.a ../shared/libmangosnetwork.a ../framework/libmangosframework.a ../../dep/src/zthread/libZThread.la ../../dep/src/g3dlite/libg3dlite.a
-mangos_worldd_LDFLAGS = -L../../dep/src/zthread -L../../dep/src/g3dlite -L../bindings/universal/ $(MYSQL_LIBS) $(POSTGRE_LIBS) -L$(libdir) $(ZLIB) $(COMPATLIB) $(SSLLIB) -export-dynamic
+mangos_worldd_LDADD = ../bindings/ScriptDev2/libmangosscript.la ../game/libmangosgame.a ../shared/libmangosdatabase.a ../shared/libmangosconfig.a ../shared/libmangosauth.a ../shared/libmangosshared.a ../shared/libmangosvmaps.a ../shared/libmangosnetwork.a ../framework/libmangosframework.a ../../dep/src/zthread/libZThread.la ../../dep/src/g3dlite/libg3dlite.a
+mangos_worldd_LDFLAGS = -L../../dep/src/zthread -L../../dep/src/g3dlite -L../bindings/ScriptDev2/ $(MYSQL_LIBS) $(POSTGRE_LIBS) -L$(libdir) $(ZLIB) $(COMPATLIB) $(SSLLIB) -export-dynamic

## Additional files to include when running 'make dist'
# Include world daemon configuration

Index: src/realmd/AuthSocket.cpp // 4642当机补丁
===================================================================
--- trunk/src/realmd/AuthSocket.cpp 2007/10/25 19:35:58 4641
+++ trunk/src/realmd/AuthSocket.cpp 2007/10/25 20:47:51 4642
@@ -309,7 +309,12 @@
x.SetBinary(sha.GetDigest(), sha.GetLength());
v = g.ModExp(x, N);
// No SQL injection (username escaped)
- dbRealmServer.PExecute("UPDATE `account` SET `v` = '%s', `s` = '%s' WHERE UPPER(`username`)= UPPER('%s')",v.AsHexStr(),s.AsHexStr(), _safelogin.c_str() );
+ const char *v_hex, *s_hex;
+ v_hex = v.AsHexStr();
+ s_hex = s.AsHexStr();
+ dbRealmServer.PExecute("UPDATE `account` SET `v` = '%s', `s` = '%s' WHERE UPPER(`username`)= UPPER('%s')",v_hex,s_hex, _safelogin.c_str() );
+ OPENSSL_free((void*)v_hex);
+ OPENSSL_free((void*)s_hex);
}

/// Logon Challenge command handler
@@ -435,6 +440,10 @@
b.SetRand(19 * 8);
BigNumber gmod=g.ModExp(b, N);
B = ((v * 3) + gmod) % N;
+
+ if (B.GetNumBytes() < 32)
+ sLog.outDetail("Interesting, calculation of B in realmd is < 32.");
+
ASSERT(gmod.GetNumBytes() <= 32);

BigNumber unk3;
@@ -442,7 +451,7 @@

///- Fill the response packet with the result
pkt << (uint8)REALM_AUTH_SUCCESS;
- pkt.append(B.AsByteArray(), 32);
+ pkt.append(B.AsByteArray(), B.GetNumBytes());
pkt << (uint8)1;
pkt.append(g.AsByteArray(), 1);
pkt << (uint8)32;
@@ -456,7 +465,10 @@

QueryResult *localeresult = dbRealmServer.PQuery("SELECT `locale` FROM `localization` WHERE `string` = '%c%c'",ch->country[3],ch->country[2]);
if( localeresult )
+ {
_localization=(*localeresult)[0].GetUInt8();
+ delete localeresult;
+ }
else
_localization=LOCALE_ENG;
if (_localization>=MAX_LOCALE)
@@ -609,7 +621,9 @@

///- Update the sessionkey, last_ip and last login time in the account table for this account
// No SQL injection (escaped user name) and IP address as received by socket
- dbRealmServer.PExecute("UPDATE `account` SET `sessionkey` = '%s', `last_ip` = '%s', `last_login` = NOW(), `locale` = '%u' WHERE `username` = '%s'",K.AsHexStr(), GetRemoteAddress().c_str(), _localization, _safelogin.c_str() );
+ const char* K_hex = K.AsHexStr();
+ dbRealmServer.PExecute("UPDATE `account` SET `sessionkey` = '%s', `last_ip` = '%s', `last_login` = NOW(), `locale` = '%u' WHERE `username` = '%s'", K_hex, GetRemoteAddress().c_str(), _localization, _safelogin.c_str() );
+ OPENSSL_free((void*)K_hex);

///- Finish SRP6 and send the final result to the client
sha.Initialize();

Index: src/game/BattleGroundMgr.cpp // 4624当机补丁
===================================================================
--- trunk/src/game/BattleGroundMgr.cpp 2007/10/19 20:11:42 4623
+++ trunk/src/game/BattleGroundMgr.cpp 2007/10/21 01:24:05 4624
@@ -327,12 +327,15 @@
bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 p_time)
{
Player* plr = objmgr.GetPlayer( m_PlayerGuid );
+
+ // player logged off (we should do nothing, he is correctly removed from queue in another procedure)
if (!plr)
- // player logged off (we should do nothing, he is correctly removed from queue in another procedure)
return true;
+
+ // player is already in battleground ... do nothing (battleground queue status is deleted when player is teleported to BG)
if (plr->GetBattleGroundId() > 0)
- // player is already in battleground ... do nothing (battleground queue status is deleted when player is teleported to BG)
return true;
+
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID);
if (bg)
{
@@ -340,7 +343,9 @@
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
{
// check if player is invited to this bg ... this check must be here, because when player leaves queue and joins another, it would cause a problems
- if (sBattleGroundMgr.m_BattleGroundQueues[bg->GetTypeID()].m_QueuedPlayers[bg->GetQueueType()].find(m_PlayerGuid)->second.IsInvitedToBGInstanceGUID == m_BgInstanceGUID)
+ BattleGroundQueue::QueuedPlayersMap const& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bg->GetTypeID()].m_QueuedPlayers[bg->GetQueueType()];
+ BattleGroundQueue::QueuedPlayersMap::const_iterator qItr = qpMap.find(m_PlayerGuid);
+ if (qItr != qpMap.end() && qItr->second.IsInvitedToBGInstanceGUID == m_BgInstanceGUID)
{
WorldPacket data;
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, plr->GetTeam(), queueSlot, STATUS_WAIT_JOIN, BG_REMIND_INVITE_TIME, 0);


Index: src/game/ChatHandler.cpp // 4636当机补丁
==========================================================================
--- trunk/src/game/ChatHandler.cpp 2007/10/24 06:05:36 4635
+++ trunk/src/game/ChatHandler.cpp 2007/10/24 06:35:42 4636
@@ -92,6 +92,9 @@
std::string msg = "";
recv_data >> msg;

+ if(msg.empty())
+ break;
+
if (sChatHandler.ParseCommands(msg.c_str(), this) > 0)
break;

@@ -110,6 +113,9 @@
CHECK_PACKET_SIZE(recv_data,4+4+(to.size()+1)+1);
recv_data >> msg;

+ if(msg.empty())
+ break;
+
if(to.empty())
{
WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, (to.size()+1));
@@ -150,6 +156,9 @@
std::string msg = "";
recv_data >> msg;

+ if(msg.empty())
+ break;
+
if (sChatHandler.ParseCommands(msg.c_str(), this) > 0)
break;

@@ -167,6 +176,9 @@
std::string msg = "";
recv_data >> msg;

+ if(msg.empty())
+ break;
+
if (sChatHandler.ParseCommands(msg.c_str(), this) > 0)
break;

@@ -184,6 +196,9 @@
std::string msg = "";
recv_data >> msg;

+ if(msg.empty())
+ break;
+
if (sChatHandler.ParseCommands(msg.c_str(), this) > 0)
break;

@@ -200,6 +215,9 @@
std::string msg="";
recv_data >> msg;

+ if(msg.empty())
+ break;
+
if (sChatHandler.ParseCommands(msg.c_str(), this) > 0)
break;

@@ -216,6 +234,9 @@
std::string msg="";
recv_data >> msg;

+ if(msg.empty())
+ break;
+
if (sChatHandler.ParseCommands(msg.c_str(), this) > 0)
break;

@@ -232,6 +253,9 @@
std::string msg="";
recv_data >> msg;

+ if(msg.empty())
+ break;
+
Group *group = GetPlayer()->GetGroup();
if(!group || !group->isRaidGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
return;
@@ -246,6 +270,9 @@
std::string msg="";
recv_data >> msg;

+ if(msg.empty())
+ break;
+
Group *group = GetPlayer()->GetGroup();
if(!group || !group->isRaidGroup())
return;
@@ -260,6 +287,9 @@
std::string msg="";
recv_data >> msg;

+ if(msg.empty())
+ break;
+
Group *group = GetPlayer()->GetGroup();
if(!group || !group->isRaidGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
return;
@@ -279,6 +309,9 @@

recv_data >> msg;

+ if(msg.empty())
+ break;
+
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
if(Channel *chn = cMgr->GetChannel(channel,_player))
栏目列表