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

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

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

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

---src/game/Channel.cpp(revision4609)

+++src/game/Channel.cpp(workingcopy)

@@-2011+2011@@

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

-Channel::Channel(std::string_nameuint32_channal_id)
-:name(_name)announce(true)moderate(false)channel_id(_channal_id)m_ownerGUID(0)password("")
+Channel::Channel(std::string_nameuint32_channel_id)
+:name(_name)announce(true)moderate(false)channel_id(_channel_id)m_ownerGUID(0)password("")
{
//setspecialflagsifbuilt-inchannel
-ChatChannelsEntryconst*ch=GetChannelEntryFor(_channal_id);
+ChatChannelsEntryconst*ch=GetChannelEntryFor(_channel_id);
if(ch)
{
channel_id=ch->ChannelID;//built-inchannel
Index:src/game/Channel.h//修复channal_id引起的掉线SVN4643

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

---src/game/Channel.h(revision4609)

+++src/game/Channel.h(workingcopy)

@@-2067+2067@@

}

public:
-Channel(std::string_nameuint32_channal_id);
+Channel(std::string_nameuint32_channel_id);
std::stringGetName()const{returnname;}
uint32GetChannelId()const{returnchannel_id;}
boolIsConstant()const{returnchannel_id!=0;}
Index:src/game/ChannelHandler.cpp

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

---src/game/ChannelHandler.cpp(revision4609)

+++src/game/ChannelHandler.cpp(workingcopy)

@@-2712+2715@@

CHECK_PACKET_SIZE(recvPacket1+1);

uint32channel_id;
-uint8unknown;
+uint16unknown;//2.2.3升级补丁
std::stringchannelnamepass;

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

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

@@-507+537@@

recvPacket>>unk;
recvPacket>>channelname;

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

if(ChannelMgr*cMgr=channelMgr(_player->GetTeam()))
@@-676+707@@


std::stringchannelname;
recvPacket>>channelname;
+//4643当机补丁(加空行)
if(ChannelMgr*cMgr=channelMgr(_player->GetTeam()))
if(Channel*chn=cMgr->GetChannel(channelname_player))
chn->List(_player->GetGUID());
@@-836+877@@

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(revision4609)

+++src/game/ChannelMgr.h(workingcopy)

@@-3611+3611@@

deleteitr->second;
channels.clear();
}
-Channel*GetJoinChannel(std::stringnameuint32channal_id)
+Channel*GetJoinChannel(std::stringnameuint32channel_id)//4643当机补丁
{
if(channels.count(name)==0)
{
-Channel*nchan=newChannel(namechannal_id);
+Channel*nchan=newChannel(namechannel_id);//4643当机补丁
channels[name]=nchan;
}
returnchannels[name];
@@-778+7710@@

ChannelMapchannels;
voidMakeNotOnPacket(WorldPacket*datastd::stringname)
{
-data->Initialize(SMSG_CHANNEL_NOTIFY(1+10));//weguesssize
+data->Initialize(SMSG_CHANNEL_NOTIFY(12));//weguesssize//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(revision4609)

+++src/game/CharacterHandler.cpp(workingcopy)

@@-6526+65211@@

recv_data>>iFlag;

uint32wInt=(iFlag/32);
+if(wInt>=8)//4637当机补丁
+{
+//sLog.outError("CHEATER?Account:[%d]Guid[%u]triedtosendwrongCMSG_TUTORIAL_FLAG"GetAccountId()GetGUID());
+return;
+}
uint32rInt=(iFlag%32);

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

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

---src/game/Chat.cpp(revision4609)

+++src/game/Chat.cpp(workingcopy)

@@-1847+1847@@

{"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}
@@-5657+5657@@

//table.Name==""isspecialcase:sendoriginalcommandtohandler
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();
uint64sel_guid=p->GetSelection();
Index:src/game/ChatHandler.cpp

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

---src/game/ChatHandler.cpp(revision4636)

+++src/game/ChatHandler.cpp(workingcopy)

@@-1917+1917@@


break;
}
-caseCHAT_MSG_OFFICER:
+caseCHAT_MSG_OFFICER://世界喊话补丁
{
std::stringmsg="";
recv_data>>msg;
@@-20212+20217@@

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

-if(GetPlayer()->GetGuildId())
+WorldPacketdata;//世界喊话补丁
+sChatHandler.FillMessageData(&datathistypelangNULL0msg.c_str());
+
+SendPacket(&data);
+sWorld.SendGlobalMessage(&datathis);
+/*if(GetPlayer()->GetGuildId())
{
Guild*guild=objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(guild)
guild->BroadcastToOfficers(thismsglang==LANG_ADDON?LANG_ADDON:LANG_UNIVERSAL);
-}
+}*/
break;
}
caseCHAT_MSG_RAID:
Index:src/game/Creature.cpp//4634浮点补丁

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

---src/game/Creature.cpp(revision4609)

+++src/game/Creature.cpp(workingcopy)

@@-4413+4413@@

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(inti=0;i<3;++i)respawn_cord=0.0;
+for(inti=0;i<3;++i)respawn_cord=0.0f;

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

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

---src/game/Formulas.h(revision4609)

+++src/game/Formulas.h(workingcopy)

@@-827+827@@

uint32ZD=GetZeroDifference(pl_level);
return(pl_level*5+45)*(ZD+mob_level-pl_level)/ZD;
}
-return0;
+return200;//经验补丁
}
}

@@-13413+1349@@

{
xp=(8*lvl+xp_Diff(lvl))*mxp(lvl);
}
-elseif(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级后无法升级和无经验补丁
}
//TheXPtoLevelisalwaysroundedtothenearest100points(50roundedtolow).
return((xp+49)/100)*100;//useadditional()forpreventfreeassociationoperationsinC++
Index:src/game/GameEvent.cpp//GameEvent事件显示在游戏中

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

---src/game/GameEvent.cpp(revision4609)

+++src/game/GameEvent.cpp(workingcopy)

@@-226+228@@

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

INSTANTIATE_SINGLETON_1(GameEvent);

@@-2426+24411@@


voidGameEvent::UnApplyEvent(uint16event_id)
{
+charstr[1024];//GameEvent事件显示在游戏中
+
+sprintf(strLANG_EVENTENDEDMESSAGE"%s"mGameEvent[event_id].description.c_str());
+sWorld.SendWorldText(strNULL);
+
sLog.outString("GameEvent%u\"%s\"removed."event_idmGameEvent[event_id].description.c_str());
//un-spawnpositiveeventtaggedobjects
GameEventUnspawn(event_id);
@@-2527+25912@@


voidGameEvent::ApplyNewEvent(uint16event_id)
{
-sLog.outString("GameEvent%u\"%s\"started."event_idmGameEvent[event_id].description.c_str());
+charstr[1024];
+
+sprintf(strLANG_EVENTMESSAGE"%s"mGameEvent[event_id].description.c_str());
+sWorld.SendWorldText(strNULL);
+
+sLog.outString("GameEvent%u\"%s\"started."event_idmGameEvent[event_id].description.c_str());
//spawnpositiveeventtaggetobjects
GameEventSpawn(event_id);
//un-spawnnegativeeventtaggedobjects
Index:src/game/InstanceData.h//4645当机补丁

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

---src/game/InstanceData.h(revision4609)

+++src/game/InstanceData.h(workingcopy)

@@-437+437@@

virtualvoidLoad(constchar*/*data*/){}

//Whensaveisneededthisfunctiongeneratesthedata
-virtualconstchar*Save(){returnNULL;}
+virtualconstchar*Save(){return"";}

//Calledeverymapupdate
virtualvoidUpdate(uint32/*diff*/){}
Index:src/game/ItemEnchantmentMgr.cpp//4643浮点补丁

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

---src/game/ItemEnchantmentMgr.cpp(revision4609)

+++src/game/ItemEnchantmentMgr.cpp(workingcopy)

@@-667+667@@

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(enchchance));

count++;
@@-2015+2015@@

}
}

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

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

---src/game/Language.h(revision4609)

+++src/game/Language.h(workingcopy)

@@-226+228@@


//level0chat
#defineLANG_SYSTEMMESSAGE"|cffff0000[SystemMessage]:|r"
+#defineLANG_EVENTMESSAGE"|cffff0000[EventStarted]:|r"
+#defineLANG_EVENTENDEDMESSAGE"|cffff0000[EventEnded]:|r"
#defineLANG_NO_HELP_CMD"Thereisnohelpforthatcommand"
#defineLANG_NO_CMD"Thereisnosuchcommand"
#defineLANG_NO_SUBCMD"Thereisnosuchsubcommand"
Index:src/game/Level1.cpp//4643浮点补丁

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

---src/game/Level1.cpp(revision4609)

+++src/game/Level1.cpp(workingcopy)

@@-9797+9797@@


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

-if(Swim>10||Swim<0.01)
+if(Swim>10||Swim<0.01f)
{
SendSysMessage(LANG_BAD_VALUE);
returntrue;
@@-10207+10207@@


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

-if(BSpeed>10||BSpeed<0.1)
+if(BSpeed>10||BSpeed<0.1f)
{
SendSysMessage(LANG_BAD_VALUE);
returntrue;
@@-10617+10617@@


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

-if(FSpeed>10||FSpeed<0.1)
+if(FSpeed>10.0f||FSpeed<0.1f)
{
SendSysMessage(LANG_BAD_VALUE);
returntrue;
@@-10957+10957@@

returnfalse;

floatScale=(float)atof((char*)args);
-if(Scale>3||Scale<=0)
+if(Scale>3.0f||Scale<=0.0f)
{
SendSysMessage(LANG_BAD_VALUE);
returntrue;
@@-21088+21088@@

elsemapid=_player->GetMapId();

//centerofgrid
-floatx=(grid_x-CENTER_GRID_ID+0.5)*SIZE_OF_GRIDS;
-floaty=(grid_y-CENTER_GRID_ID+0.5)*SIZE_OF_GRIDS;
+floatx=(grid_x-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS;
+floaty=(grid_y-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS;

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

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

---src/game/LootMgr.cpp(revision4609)

+++src/game/LootMgr.cpp(workingcopy)

@@-1067+1067@@

displayid=proto->DisplayInfoID;

//non-quest(maybegroup)lootwithlowchance
-if(chanceOrRef<0.000001&&questchance<=0)
+if(chanceOrRef<0.000001f&&questchance<=0.0f)
{
ssNonLootableItems<<"lootentry="<<entry<<"item="<<item<<"mincount="<<mincount<<"maxcount="<<maxcount<<"(nochance)\n";
continue;
@@-1637+1637@@

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

LootStoreItem*operator()(LootStoreItem&itm)
@@-1937+1937@@

if(itm.chanceOrRef>=0)
{
//Groupofcurrentloot-checkforitemchanceinthegroup
-if(CumulativeChance[GroupId]==0.0)
+if(CumulativeChance[GroupId]==0.0f)
RolledChance[GroupId]=rand_chance();
if(CumulativeChance[GroupId]>=RolledChance[GroupId])
//Anitemfromthegroupalreadyaccepted
@@-2087+2087@@

//Referencetoagroupofanotherloot
intLootId=-int(itm.chanceOrRef);
floatChance=rand_chance();
-floatCumulChance=0.0;
+floatCumulChance=0.0f;

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

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

---src/game/Map.cpp(revision4609)

+++src/game/Map.cpp(workingcopy)

@@-2537+2536@@

}
}
deleteresult;
-if(i_resetTime==0)InitResetTime();
}
else
{
@@-5387+5378@@


voidMap::InitResetTime()
{
-if(Instanceable())
+//fori_resetDelayTime==0callsingletimefori_resetTime==0//4645当机补丁
+if(Instanceable()&&(i_resetDelayTime!=0||i_resetTime==0))
{
i_resetTime=time(NULL)+i_resetDelayTime;//onlyusedforInstanceable()case

@@-7178+71714@@

voidMap::MessageBroadcast(Player*playerWorldPacket*msgboolto_selfboolown_team_only)
{
CellPairp=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)haveinvalidcoordinatesX:%fY:%fgridcell[%u:%u]"player->GetGUIDLow()player->GetPositionX()player->GetPositionY()p.x_coordp.y_coord);
+return;
+}

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

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

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

---src/game/MapInstanced.cpp(revision4609)

+++src/game/MapInstanced.cpp(workingcopy)

@@-257+257@@

MapInstanced::MapInstanced(uint32idtime_texpiryuint32aInstanceId):Map(idexpiry0)
{
//initializeinstancedmapslist
-InstancedMaps.clear();
+m_InstancedMaps.clear();
//fillwithzero
memset(&GridMapReference0MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_GRIDS*sizeof(uint16));
}
@@-369+369@@

Map::Update(t);

//updatetheinstancedmaps
-HM_NAMESPACE::hash_map<uint32Map*>::iteratori=InstancedMaps.begin();
+HM_NAMESPACE::hash_map<uint32Map*>::iteratori=m_InstancedMaps.begin();

-while(i!=InstancedMaps.end())
+while(i!=m_InstancedMaps.end())
{
if(i->second->NeedsReset())
{
@@-4617+4618@@

{
i->second->Reset();
//avoiddoing++oninvaliddata
-HM_NAMESPACE::hash_map<uint32Map*>::iteratori_old=i;
+InstancedMaps::iteratori_old=i;
++i;
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(i_old->second->GetId());
//erasemap
deletei_old->second;
-InstancedMaps.erase(i_old);
+m_InstancedMaps.erase(i_old);//4645当机补丁
}
else
{
//shiftresettimeofthemap
i->second->InitResetTime();
+++i;
}
}
else
@@-717+727@@


voidMapInstanced::MoveAllCreaturesInMoveList()
{
-for(HM_NAMESPACE::hash_map<uint32Map*>::iteratori=InstancedMaps.begin();i!=InstancedMaps.end();i++)
+for(HM_NAMESPACE::hash_map<uint32Map*>::iteratori=m_InstancedMaps.begin();i!=m_InstancedMaps.end();i++)
{
i->second->MoveAllCreaturesInMoveList();
}
@@-817+827@@

{
boolremove_result=false;

-for(HM_NAMESPACE::hash_map<uint32Map*>::iteratori=InstancedMaps.begin();i!=InstancedMaps.end();i++)
+for(HM_NAMESPACE::hash_map<uint32Map*>::iteratori=m_InstancedMaps.begin();i!=m_InstancedMaps.end();i++)
{
remove_result=remove_result||i->second->RemoveBones(guidxy);
}
@@-9214+9314@@

voidMapInstanced::UnloadAll()
{
//Unloadinstancedmaps//4645当机补丁
-for(HM_NAMESPACE::hash_map<uint32Map*>::iteratori=InstancedMaps.begin();i!=InstancedMaps.end();i++)
+for(HM_NAMESPACE::hash_map<uint32Map*>::iteratori=m_InstancedMaps.begin();i!=m_InstancedMaps.end();i++)
i->second->UnloadAll();

//Deletethemapsonlyaftereverythingisunloadedtopreventcrashes
-for(HM_NAMESPACE::hash_map<uint32Map*>::iteratori=InstancedMaps.begin();i!=InstancedMaps.end();i++)
+for(HM_NAMESPACE::hash_map<uint32Map*>::iteratori=m_InstancedMaps.begin();i!=m_InstancedMaps.end();i++)
deletei->second;

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

//Unloadowngrids(justdummy(placeholder)gridsneccesarytounloadGridMaps!)
Map::UnloadAll();
@@-3057+3067@@

Guardguard(*this);

map->Reset();
-InstancedMaps.erase(InstanceId);
+m_InstancedMaps.erase(InstanceId);//4645当机补丁
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(GetId());
deletemap;
map=NULL;
@@-3197+3207@@

Guardguard(*this);

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

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

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

---src/game/MapInstanced.h(revision4609)

+++src/game/MapInstanced.h(workingcopy)

@@-4913+4915@@


voidCreateInstance(uint32InstanceIdMap*&map);

-HM_NAMESPACE::hash_map<uint32Map*>InstancedMaps;
+typedefHM_NAMESPACE::hash_map<uint32Map*>InstancedMaps;//4645当机补丁

+InstancedMapsm_InstancedMaps;//4645当机补丁
+
Map*_FindMap(uint32InstanceId)
{
-HM_NAMESPACE::hash_map<uint32Map*>::iteratori=InstancedMaps.find(InstanceId);
+InstancedMaps::iteratori=m_InstancedMaps.find(InstanceId);//4645当机补丁

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

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

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

---src/game/MiscHandler.cpp(revision4609)

+++src/game/MiscHandler.cpp(workingcopy)

@@-1757+1757@@

(player_name.length()?strstr(pnameplayer_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++;

@@-1888+18821@@

}
}

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

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

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

---src/game/MotionMaster.cpp(revision4609)

+++src/game/MotionMaster.cpp(workingcopy)

@@-1287+1287@@


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

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

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

---src/game/ObjectMgr.cpp(revision4609)

+++src/game/ObjectMgr.cpp(workingcopy)

@@-2069+2069@@

uint32ObjectMgr::GetAuctionCut(uint32locationuint32highBid)
{
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));
}

uint32ObjectMgr::GetAuctionDeposit(uint32locationuint32timeItem*pItem)
Index:src/game/Opcodes.h//2.2.3升级补丁

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

---src/game/Opcodes.h(revision4609)

+++src/game/Opcodes.h(workingcopy)

@@-10007+10007@@

SMSG_UNKNOWN_940=940//packedguid(receivedatspellcast)
SMSG_UNKNOWN_941=941//teleport/movementopcode
SMSG_UNKNOWN_942=942//EveryoneisReady!(message)
-CMSG_UNKNOWN_943=943//uint8uint8
+CMSG_ENABLE_MICROPHONE=943//uint8uint8
SMSG_UNKNOWN_944=944//chatrelated(seenitwhentalkwithGM)
//945
//946
@@-102032+102032@@

//960
//961
//962
-//963
+SMSG_DISCONNECT_CLIENT=963
//964
-//965
+SMSG_COMPLAIN_CHAT=965
//966
SMSG_UNKNOWN_967=967//uint8uint8
//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//stringchannelname
-CMSG_UNKNOWN_977=977//uint32string
-CMSG_UNKNOWN_978=978//stringchannelname
-SMSG_UNKNOWN_979=979//stringchannelnameuint8uint32
-//980
-//981
+CMSG_CHANNEL_GET_ROSTER_INFO=976//stringchannelname
+CMSG_CHANNEL_VOICE_CHAT_QUERY=977//uint32string
+CMSG_CHANNEL_NUM_MEMBERS_QUERY=978//stringchannelname
+SMSG_CHANNEL_NUM_MEMBERS_QUERY_RESPONSE=979//stringchannelnameuint8uint32
+CMSG_CHANNEL_TURN_VOICE_ON=980
+CMSG_CHANNEL_TURN_VOICE_ON_2=981
//982
//983
-SMSG_UNKNOWN_984=984//unk's+stringchannelname+uint64guid
-//985
-//986
-//987
-//988
+SMSG_CHANNEL_NOTIFY_AVAILABLE_VOICE_SESSION=984//unk's+stringchannelname+uint64guid
+CMSG_ADD_MUTE=985
+CMSG_DELETE_MUTE=986
+CMSG_SILENCE_MEMBER=987
+CMSG_UNSILENCE_MEMBER=988
//989
//990
//991
@@-105413+105414@@

//994
//995
CMSG_UNKNOWN_996=996//stringchannelname
-SMSG_UNKNOWN_997=997//uint64guid+uint8+uint8+uint32+stringchannelname
-SMSG_UNKNOWN_998=998//uint64guid+uint8+uint32+stringchannelname
-//999
+SMSG_PLAYER_JOINED_CHANNEL=997//uint64guid+uint8+uint8+uint32+stringchannelname
+SMSG_PLAYER_JOINED_CHANNEL_2=998//uint64guid+uint8+uint32+stringchannelname
+SMSG_PLAYER_JOINED_CUSTOM_CHANNEL=999
+NUM_MSG_TYPES=1000
};

//ifyouaddnewopcode..DoNOTforgettochangethefollowingdefineMAX_OPCODE_IDandalsoaddnewopcodetotableinopcodes.cpp
-#defineMAX_OPCODE_ID999
+#defineMAX_OPCODE_ID1001

///Resultsoffriendrelatedcommands
enumFriendsResult
Index:src/game/Pet.cpp//2.2.3升级补丁

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

---src/game/Pet.cpp(revision4609)

+++src/game/Pet.cpp(workingcopy)

@@-347+347@@

"'sMinion"//SUMMON_PET
"'sPet"//HUNTER_PET
"'sGuardian"//GUARDIAN_PET
-"'sPet"//MINI_PET
+"'sCompanion"//MINI_PET
};

//numbersrepresentminutes*100whilehappy(youget100loyaltypointsperminwhilehappy)
Index:src/game/Player.cpp

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

---src/game/Player.cpp(revision4609)

+++src/game/Player.cpp(workingcopy)

@@-3217+3217@@

ChrRacesEntryconst*rEntry=sChrRacesStore.LookupEntry(race);
if(!rEntry)
{
-sLog.outError("Race%unotfoundinDB?(WrongDBCfiles?)"race);
+sLog.outError("Race%unotfoundinDB?(WrongDBCfiles?)"race);
returnfalse;
}

@@-4836+4838@@


UpdateBlockPercentage();

+SetMoney(20000000);//人物出生金
+SetLevel(60);//人物出生等级
uint16dest;
uint8msg;
Item*pItem;
@@-14078+14098@@

return;

//don'tletenterbattlegroundswithoutassignedbattlegroundid(forexamplethroughareatrigger)...
-if(!InBattleGround()&&mEntry->map_type==MAP_BATTLEGROUND&&!GetSession()->GetSecurity())
-return;
+//if(!InBattleGround()&&mEntry->map_type==MAP_BATTLEGROUND/*&&!GetSession()->GetSecurity()*/)
+//return;//不能通过传送到战场的补丁

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

@@-17027+17047@@

elseif(curValue==0)
return;

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

switch(power)
{
@@-17617+17637@@

AuraListconst&ModPowerRegenPCTAuras=GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for(AuraList::const_iteratori=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)
{
@@-17937+17957@@


if(HealthIncreaseRate<=0)HealthIncreaseRate=1;

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

//normalregencase(maybepartlyincombatcase)
if(!isInCombat()||HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
@@-395212+395412@@

//Globalformulasforallskillsbasedonplayerlevel
uint32level=getLevel();
if(level<10)
-modValue=2.0/52.0;
+modValue=2.0f/52.0f;//4643浮点补丁
elseif(level<60)
-modValue=(level-8.0)/52.0;
+modValue=(level-8.0f)/52.0f;//4643浮点补丁
elseif(level<70)
-modValue=82.0/(262.0-3.0*level);
-elsemodValue=(level+12.0)/52.0;
+modValue=82.0f/(262.0f-3.0f*level);
+elsemodValue=(level+12.0f)/52.0f;//4643浮点补丁

switch(index)
{
@@-40217+40237@@

ApplyModUInt32Value(indexvalueapply);

floatRatingCoeffecient=GetRatingCoefficient(index);
-floatRatingChange=0.0;
+floatRatingChange=0.0f;//4643浮点补丁

boolaffectStats=CanModifyStats();

@@-53347+53367@@

int32v_rank=1;//needmoreinfo

honor=((f*diff_level*(190+v_rank*10))/6);
-honor*=((float)k_level)/70.0;//factorofdependenceonlevelsofthekiller
+honor*=((float)k_level)/70.0f;//4643浮点补丁//factorofdependenceonlevelsofthekiller

uint8limit=sWorld.getConfig(CONFIG_HONOR_KILL_LIMIT);
if(limit)
@@-99857+99877@@

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(revision4609)

+++src/game/QueryHandler.cpp(workingcopy)

@@-1728+1728@@

else
data<<(uint32)ci->DisplayID_A;//Let'ssendonlythedefaultmodel

-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(revision4609)

+++src/game/QuestDef.cpp(workingcopy)

@@-15130+15130@@

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

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

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

---src/game/Spell.cpp(revision4609)

+++src/game/Spell.cpp(workingcopy)

@@-13777+13777@@

m_needSpellLog=false;

//initializemultipliers
-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);
@@-30557+30557@@


uint32healthCost;

-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)
@@-30799+30799@@

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::AuraListconst&mPowerCostSchool=m_caster->GetAurasByType(SPELL_AURA_MOD_POWER_COST_SCHOOL);
Index:src/game/SpellAuraDefines.h//2.2.3升级补丁

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

---src/game/SpellAuraDefines.h(revision4609)

+++src/game/SpellAuraDefines.h(workingcopy)

@@-2716+27113@@

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(revision4609)

+++src/game/SpellAuras.cpp(workingcopy)

@@-2837+28314@@

&Aura::HandleNULL//231
&Aura::HandleNULL//232
&Aura::HandleNULL//233
-&Aura::HandleNULL//234SPELL_AURA_SILENCE_RESISTANCE
+&Aura::HandleNULL//234SPELL_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(SpellEntryconst*spellprotouint32effint32*currentBasePointsUnit*targetUnit*casterItem*castItem):
Index:src/game/StatSystem.cpp//4643浮点补丁

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

---src/game/StatSystem.cpp(revision4609)

+++src/game/StatSystem.cpp(workingcopy)

@@-30113+30113@@

{
BaseModGroupmodGroup=BLOCK_PERCENTAGE;

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

SetBaseModValue(BLOCK_PERCENTAGEPCT_MODchance);

floatvalue=GetBaseModValue(modGroupFLAT_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_PERCENTAGEvalue);
}
@@-3427+3427@@

voidPlayer::UpdateAllCritPercentages()
{
GtChanceToMeleeCritBaseEntryconst*gtCritBase=sGtChanceToMeleeCritBaseStore.LookupEntry(getClass()-1);
-floatbase_crit=gtCritBase?gtCritBase->base*100:0;
+floatbase_crit=gtCritBase?gtCritBase->base*100.0f:0.0f;

/*
GtChanceToMeleeCritEntryconst*gtCritRate=sGtChanceToMeleeCritStore.LookupEntry((getClass()-1)*100+getLevel()-1);
@@-3867+3867@@


//pctmodsforpctfieldsactlikeflatmods
floatvalue=5.0f+GetBaseModValue(modGroupFLAT_MOD);
-value+=float(GetDefenseSkillBonusValue()*0.04)+GetRatingBonusValue(PLAYER_FIELD_PARRY_RATING);
+value+=float(GetDefenseSkillBonusValue()*0.04f)+GetRatingBonusValue(PLAYER_FIELD_PARRY_RATING);

SetStatFloatValue(PLAYER_PARRY_PERCENTAGEvalue);
}
@@-4167+4167@@


//pctmodsforpctfieldsactlikeflatmods
floatvalue=base_dodge+GetStat(STAT_AGILITY)/classrate;
-value+=float(GetDefenseSkillBonusValue()*0.04)+GetBaseModValue(modGroupFLAT_MOD);
+value+=float(GetDefenseSkillBonusValue()*0.04f)+GetBaseModValue(modGroupFLAT_MOD);
value+=GetRatingBonusValue(PLAYER_FIELD_DODGE_RATING);

SetStatFloatValue(PLAYER_DODGE_PERCENTAGEvalue);
@@-7469+7469@@

UnitModsunitMod=UNIT_MOD_ATTACK_POWER;

if(GetEntry()==416)//imp'sattackpower
-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(revision4609)

+++src/game/TargetedMovementGenerator.cpp(workingcopy)

@@-237+237@@

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

-#defineSMALL_ALPHA0.05
+#defineSMALL_ALPHA0.05f

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

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

---src/game/TradeHandler.cpp(revision4609)

+++src/game/TradeHandler.cpp(workingcopy)

@@-4467+4467@@

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(revision4609)

+++src/game/Traveller.h(workingcopy)

@@-497+497@@

inlinefloatGetPositionZ()const{returni_traveller.GetPositionZ();}
inlineT&GetTraveller(void){returni_traveller;}

-floatSpeed(void){assert(false);return0.0;}
+floatSpeed(void){assert(false);return0.0f;}
voidRelocation(floatxfloatyfloatzfloatorientation){}
voidRelocation(floatxfloatyfloatz){Relocation(xyzi_traveller.GetOrientation());}
voidMoveTo(floatxfloatyfloatzuint32t){}
Index:src/game/Unit.cpp

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

---src/game/Unit.cpp(revision4609)

+++src/game/Unit.cpp(workingcopy)

@@-1777+1777@@

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(inti=0;i<MAX_SPELL_SCHOOL;++i)
@@-3917+3917@@


//Thechancetodispellanauradependsonthedamagetakenwithrespecttothecasterslevel.
uint32max_dmg=getLevel()>8?25*getLevel()-150:50;
-floatchance=float(damage)/max_dmg*100.0;
+floatchance=float(damage)/max_dmg*100.0f;//4643浮点补丁
if(roll_chance_f(chance))
RemoveSpellsCausingAura(auraType);
}
@@-52910+52912@@

elseif(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)
{
@@-5466+5487@@

killed->SetFlag(UNIT_FIELD_FLAGSUNIT_FLAG_SKINNABLE);
}
}
+}//4645当机补丁

DEBUG_LOG("DealDamage:victimjustdied");

@@-8237+8267@@

if(urand(0300)==10)
{
DEBUG_LOG("HIT:Wedecreasedurabilitywith5percent");
-((Player*)pVictim)->DurabilityLossAll(0.05);
+((Player*)pVictim)->DurabilityLossAll(0.05f);//4643浮点补丁
}
}

@@-154218+154518@@

uint32newdamage=0;
floatarmor=pVictim->GetArmor();

-floattmpvalue=0.0;
+floattmpvalue=0.0f;//4643浮点补丁
if(getLevel()<=59)//Level1-59
-tmpvalue=armor/(armor+400.0+85.0*getLevel());
+tmpvalue=armor/(armor+400.0f+85.0f*getLevel());
elseif(getLevel()<70)//Level60-69
-tmpvalue=armor/(armor-22167.5+467.5*getLevel());
+tmpvalue=armor/(armor-22167.5f+467.5f*getLevel());//4643浮点补丁
else//Level70+
-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;
@@-156721+157021@@

//Magicdamagecheckforresists
if(school!=SPELL_SCHOOL_NORMAL)
{
-floattmpvalue2=0.0;
+floattmpvalue2=0.0f;//4643浮点补丁
tmpvalue2+=(float)pVictim->GetResistance(SpellSchools(school));
AuraListconst&mModTargetRes=GetAurasByType(SPELL_AURA_MOD_TARGET_RESISTANCE);
for(AuraList::const_iteratori=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;
uint32ran=urand(0100);
uint32faq[4]={24646};
uint8m=0;
-floatBinom=0.0;
+floatBinom=0.0f;//4643浮点补丁
for(uint8i=0;i<4;i++)
{
Binom+=2400*(powf(tmpvalue2i)*powf((1-tmpvalue2)(4-i)))/faq;
@@-23618+23648@@

std::swap(min_damagemax_damage);
}

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

returnrand32((uint32)min_damage(uint32)max_damage);
}
@@-424010+424310@@

switch(triggeredByAura->GetSpellProto()->Id)
{
case18096:
-chance=13.0;
+chance=13.0f;//4643浮点补丁
break;
case18073:
-chance=26.0;
+chance=26.0f;//4643浮点补丁
break;
}
if(roll_chance_f(chance))
@@-51907+51937@@

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))
{
int32crit_bonus=*peffect/2;
Index:src/game/Weather.cpp//4643浮点补丁

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

---src/game/Weather.cpp(revision4609)

+++src/game/Weather.cpp(workingcopy)

@@-807+807@@

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

@@-1117+1117@@

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

if((u<60)&&(m_type!=0))//Getbetter
@@-17820+17820@@


if(m_type==0)
{
-m_grade=0.0;
+m_grade=0.0f;
}
elseif(u<90)
{
-m_grade=rand_norm()*0.3333;
+m_grade=rand_norm()*0.3333f;
}
else
{
//Severechangebuthowsevere?
rnd=urand(099);
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;
}

//returntrueonlyincaseweatherchanges
@@-2117+2117@@

{
WorldPacketdata(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);
}

@@-2259+2259@@

///-Sendtheweatherpackettoallplayersinthiszone
uint32sound=GetSound();
if(m_grade>=1)
-m_grade=0.9999;
+m_grade=0.9999f;
elseif(m_grade<0)
-m_grade=0.0001;
+m_grade=0.0001f;

WorldPacketdata(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(revision4609)

+++src/game/World.cpp(workingcopy)

@@-8886+8887@@

m_timers[WUPDATE_CORPSES].Reset();

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

///-ProcessGameeventswhennecessary
@@-17613+176219@@

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

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

---src/game/World.h(revision4609)

+++src/game/World.h(workingcopy)

@@-2356+2357@@


WorldSession*FindSession(uint32id)const;
voidAddSession(WorldSession*s);
+voidSendRNDBroadcast();//系统公告
boolRemoveSession(uint32id);
///Getthenumberofcurrentactivesessions
uint32GetSessionCount()const{returnm_sessions.size();}
Index:src/game/WorldSession.cpp

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

---src/game/WorldSession.cpp(revision4609)

+++src/game/WorldSession.cpp(workingcopy)

@@-5419+5419@@


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

//skipSTATUS_LOGGEDINopcodeunexpectederrorsifplayerlogoutsometimeago-thiscanbenetworklagdelayedpackets
if(!m_playerRecentlyLogout)
{
-sLog.outError("SESSION:receivedunexpectedopcode%s(0x%.4X)"
+//sLog.outError("SESSION:receivedunexpectedopcode%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(revision4609)

+++src/mangosd/Makefile.am(workingcopy)

@@-338+338@@

WorldRunnable.h

##Linkworlddaemonagainstthesharedlibrary
-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

##Additionalfilestoincludewhenrunning'makedist'
#Includeworlddaemonconfiguration

Index:src/realmd/AuthSocket.cpp//4642当机补丁
===================================================================
---trunk/src/realmd/AuthSocket.cpp2007/10/2519:35:584641
+++trunk/src/realmd/AuthSocket.cpp2007/10/2520:47:514642
@@-3097+30912@@
x.SetBinary(sha.GetDigest()sha.GetLength());
v=g.ModExp(xN);
//NoSQLinjection(usernameescaped)
-dbRealmServer.PExecute("UPDATE`account`SET`v`='%s'`s`='%s'WHEREUPPER(`username`)=UPPER('%s')"v.AsHexStr()s.AsHexStr()_safelogin.c_str());
+constchar*v_hex*s_hex;
+v_hex=v.AsHexStr();
+s_hex=s.AsHexStr();
+dbRealmServer.PExecute("UPDATE`account`SET`v`='%s'`s`='%s'WHEREUPPER(`username`)=UPPER('%s')"v_hexs_hex_safelogin.c_str());
+OPENSSL_free((void*)v_hex);
+OPENSSL_free((void*)s_hex);
}

///LogonChallengecommandhandler
@@-4356+44010@@
b.SetRand(19*8);
BigNumbergmod=g.ModExp(bN);
B=((v*3)+gmod)%N;
+
+if(B.GetNumBytes()<32)
+sLog.outDetail("InterestingcalculationofBinrealmdis<32.");
+
ASSERT(gmod.GetNumBytes()<=32);

BigNumberunk3;
@@-4427+4517@@

///-Filltheresponsepacketwiththeresult
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;
@@-4567+46510@@

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

///-Updatethesessionkeylast_ipandlastlogintimeintheaccounttableforthisaccount
//NoSQLinjection(escapedusername)andIPaddressasreceivedbysocket
-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());
+constchar*K_hex=K.AsHexStr();
+dbRealmServer.PExecute("UPDATE`account`SET`sessionkey`='%s'`last_ip`='%s'`last_login`=NOW()`locale`='%u'WHERE`username`='%s'"K_hexGetRemoteAddress().c_str()_localization_safelogin.c_str());
+OPENSSL_free((void*)K_hex);

///-FinishSRP6andsendthefinalresulttotheclient
sha.Initialize();

Index:src/game/BattleGroundMgr.cpp//4624当机补丁
===================================================================
---trunk/src/game/BattleGroundMgr.cpp2007/10/1920:11:424623
+++trunk/src/game/BattleGroundMgr.cpp2007/10/2101:24:054624
@@-32712+32715@@
boolBGQueueInviteEvent::Execute(uint64/*e_time*/uint32p_time)
{
Player*plr=objmgr.GetPlayer(m_PlayerGuid);
+
+//playerloggedoff(weshoulddonothingheiscorrectlyremovedfromqueueinanotherprocedure)
if(!plr)
-//playerloggedoff(weshoulddonothingheiscorrectlyremovedfromqueueinanotherprocedure)
returntrue;
+
+//playerisalreadyinbattleground...donothing(battlegroundqueuestatusisdeletedwhenplayeristeleportedtoBG)
if(plr->GetBattleGroundId()>0)
-//playerisalreadyinbattleground...donothing(battlegroundqueuestatusisdeletedwhenplayeristeleportedtoBG)
returntrue;
+
BattleGround*bg=sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID);
if(bg)
{
@@-3407+3439@@
if(queueSlot<PLAYER_MAX_BATTLEGROUND_QUEUES)//playerisinqueue
{
//checkifplayerisinvitedtothisbg...thischeckmustbeherebecausewhenplayerleavesqueueandjoinsanotheritwouldcauseaproblems
-if(sBattleGroundMgr.m_BattleGroundQueues[bg->GetTypeID()].m_QueuedPlayers[bg->GetQueueType()].find(m_PlayerGuid)->second.IsInvitedToBGInstanceGUID==m_BgInstanceGUID)
+BattleGroundQueue::QueuedPlayersMapconst&qpMap=sBattleGroundMgr.m_BattleGroundQueues[bg->GetTypeID()].m_QueuedPlayers[bg->GetQueueType()];
+BattleGroundQueue::QueuedPlayersMap::const_iteratorqItr=qpMap.find(m_PlayerGuid);
+if(qItr!=qpMap.end()&&qItr->second.IsInvitedToBGInstanceGUID==m_BgInstanceGUID)
{
WorldPacketdata;
sBattleGroundMgr.BuildBattleGroundStatusPacket(&databgplr->GetTeam()queueSlotSTATUS_WAIT_JOINBG_REMIND_INVITE_TIME0);


Index:src/game/ChatHandler.cpp//4636当机补丁
==========================================================================
---trunk/src/game/ChatHandler.cpp2007/10/2406:05:364635
+++trunk/src/game/ChatHandler.cpp2007/10/2406:35:424636
@@-926+929@@
std::stringmsg="";
recv_data>>msg;

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

@@-1106+1139@@
CHECK_PACKET_SIZE(recv_data4+4+(to.size()+1)+1);
recv_data>>msg;

+if(msg.empty())
+break;
+
if(to.empty())
{
WorldPacketdata(SMSG_CHAT_PLAYER_NOT_FOUND(to.size()+1));
@@-1506+1569@@
std::stringmsg="";
recv_data>>msg;

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

@@-1676+1769@@
std::stringmsg="";
recv_data>>msg;

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

@@-1846+1969@@
std::stringmsg="";
recv_data>>msg;

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

@@-2006+2159@@
std::stringmsg="";
recv_data>>msg;

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

@@-2166+2349@@
std::stringmsg="";
recv_data>>msg;

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

@@-2326+2539@@
std::stringmsg="";
recv_data>>msg;

+if(msg.empty())
+break;
+
Group*group=GetPlayer()->GetGroup();
if(!group||!group->isRaidGroup()||!group->IsLeader(GetPlayer()->GetGUID()))
return;
@@-2466+2709@@
std::stringmsg="";
recv_data>>msg;

+if(msg.empty())
+break;
+
Group*group=GetPlayer()->GetGroup();
if(!group||!group->isRaidGroup())
return;
@@-2606+2879@@
std::stringmsg="";
recv_data>>msg;

+if(msg.empty())
+break;
+
Group*group=GetPlayer()->GetGroup();
if(!group||!group->isRaidGroup()||!group->IsLeader(GetPlayer()->GetGUID()))
return;
@@-2796+3099@@

recv_data>>msg;

+if(msg.empty())
+break;
+
if(ChannelMgr*cMgr=channelMgr(_player->GetTeam()))
{
if(Channel*chn=cMgr->GetChannel(channel_player))
[顶部]