当前位置:首页>>魔兽单机>>正文
网一个钓鱼的补丁代码
2013-03-26 16:00:15 作者:玩家 来源: 浏览次数:0
摘要:网一个钓鱼的补丁代码
  Index: src/ascent-world/GameObject.cpp 
=================================================================== 
--- src/ascent-world/GameObject.cpp? ? (revision 3763) 
+++ src/ascent-world/GameObject.cpp? ? (working copy) 
@@ -477,41 +477,44 @@ 

void GameObject::UseFishingNode(Player *player) 

-? ? sEventMgr.RemoveEvents(this); 
-? ? if(GetUInt32Value(GAMEOBJECT_FLAGS) != 32)//click on bobber before somth is hooked 
+? ? sEventMgr.RemoveEvents( this ); 
+? ? if( GetUInt32Value( GAMEOBJECT_FLAGS ) != 32 ) // Clicking on the bobber before something is hooked 
? ? { 
-? ? ? ? player->GetSession()->OutPacket(SMSG_FISH_NOT_HOOKED); 
-? ? ? ? EndFishing(player,true); 
+? ? ? ? player->GetSession()->OutPacket( SMSG_FISH_NOT_HOOKED ); 
+? ? ? ? EndFishing( player, true ); 
? ? ? ? return; 
? ? } 
? ? 
-? ? uint32 zone=/*sAreaStore.LookupEntry(GetMapMgr()->GetAreaID(GetPositionX(),GetPositionY()))->ZoneId*/player->GetZoneId(); 
+? ? /* Unused code: sAreaStore.LookupEntry(GetMapMgr()->GetAreaID(GetPositionX(),GetPositionY()))->ZoneId*/ 
+? ? uint32 zone = player->GetAreaID(); 
+? ? if( zone == 0 ) // If the player's area ID is 0, use the zone ID instead 
+? ? ? ? zone = player->GetZoneId(); 

-? ? FishingZoneEntry *entry = FishingZoneStorage.LookupEntry(zone); 
-? ? if(entry == NULL) 
+? ? FishingZoneEntry *entry = FishingZoneStorage.LookupEntry( zone ); 
+? ? if( entry == NULL ) // No fishing information found for area or zone, log an error, and end fishing 
? ? { 
-? ? ? ? sLog.outError("ERROR: Fishing zone information for zone %d not found!", zone); 
-? ? ? ? EndFishing(player, true); 
+? ? ? ? sLog.outError( "ERROR: Fishing zone information for zone %d not found!", zone );
+? ? ? ? EndFishing( player, true ); 
? ? ? ? return; 
? ? } 
-? ? uint32 maxskill=entry->MaxSkill; 
-//? ? uint32 minskill=entry->MaxSkill; 
-? ? uint32 minskill=entry->MinSkill; 
+? ? uint32 maxskill = entry->MaxSkill; 
+//? ? uint32 minskill = entry->MaxSkill; 
+? ? uint32 minskill = entry->MinSkill; 

-? ? if(player->_GetSkillLineCurrent(SKILL_FISHING,false)<maxskill)? ? 
-? ? ? ? player->_AdvanceSkillLine(SKILL_FISHING,float2int32( 1.0f * sWorld.getRate(RATE_SKILLRATE))); 
+? ? if( player->_GetSkillLineCurrent( SKILL_FISHING, false ) < maxskill )? ? 
+? ? ? ? player->_AdvanceSkillLine( SKILL_FISHING, float2int32( 1.0f * sWorld.getRate( RATE_SKILLRATE ) ) ); 

-? ? //Open loot on success, otherwise FISH_ESCAPED. 
-? ? if(Rand(((player->_GetSkillLineCurrent(SKILL_FISHING,true)-minskill)*100)/maxskill)) 
-? ? {? ? ? ? ? ?? 
-? ? ? ? lootmgr.FillFishingLoot(&loot,zone); 
-? ? ? ? player->SendLoot(GetGUID(),3); 
-? ? ? ? EndFishing(player, false); 
+? ? // Open loot on success, otherwise FISH_ESCAPED. 
+? ? if( Rand(((player->_GetSkillLineCurrent( SKILL_FISHING, true ) - minskill) * 100) / maxskill) ) 
+? ? { 
+? ? ? ? lootmgr.FillFishingLoot( &loot, zone ); 
+? ? ? ? player->SendLoot( GetGUID(), 3 ); 
+? ? ? ? EndFishing( player, false ); 
? ? } 
-? ? else //failed 
+? ? else // Failed 
? ? { 
-? ? ? ? player->GetSession()->OutPacket(SMSG_FISH_ESCAPED); 
-? ? ? ? EndFishing(player,true); 
+? ? ? ? player->GetSession()->OutPacket( SMSG_FISH_ESCAPED ); 
+? ? ? ? EndFishing( player, true ); 
? ? } 


Index: src/ascent-world/SpellEffects.cpp 
=================================================================== 
--- src/ascent-world/SpellEffects.cpp? ? (revision 3763) 
+++ src/ascent-world/SpellEffects.cpp? ? (working copy) 
@@ -2955,73 +2955,69 @@ 

void Spell::SpellEffectSummonObject(uint32 i) 

-? ? if(!p_caster) 
+? ? if( !p_caster ) 
? ? ? ? return; 

? ? uint32 entry = m_spellInfo->EffectMiscValue

? ? uint32 mapid = u_caster->GetMapId(); 
-? ? float px=u_caster->GetPositionX(); 
-? ? float py=u_caster->GetPositionY(); 
-? ? float pz=u_caster->GetPositionZ(); 
+? ? float px = u_caster->GetPositionX(); 
+? ? float py = u_caster->GetPositionY(); 
+? ? float pz = u_caster->GetPositionZ(); 
? ? float orient = m_caster->GetOrientation(); 
? ? float posx = 0,posy = 0,posz = 0; 
? ? 
-? ? if(entry == GO_FISHING_BOBBER) 
+? ? if( entry == GO_FISHING_BOBBER ) 
? ? { 
-? ? ? ? float co=cos(orient); 
-? ? ? ? float si=sin(orient); 
+? ? ? ? float co = cos( orient ); 
+? ? ? ? float si = sin( orient ); 
? ? ? ? MapMgr * map = m_caster->GetMapMgr(); 
? ? ? ? Spell * spell = u_caster->GetCurrentSpell(); 

? ? ? ? float r; 
-? ? ? ? for( r=20;r>10;r--) 
+? ? ? ? for( r = 20; r > 10; r-- ) 
? ? ? ? { 
-? ? ? ? ? ? posx=px+r*co; 
-? ? ? ? ? ? posy=py+r*si; 
-? ? ? ? ? ? if(!(map->GetWaterType(posx,posy) & 1))//water 
+? ? ? ? ? ? posx = px+r*co; 
+? ? ? ? ? ? posy = py+r*si; 
+? ? ? ? ? ? if( !(map->GetWaterType( posx, posy ) & 1) )//water 
? ? ? ? ? ? ? ? continue; 
-? ? ? ? ? ? posz=map->GetWaterHeight(posx,posy); 
-? ? ? ? ? ? if(posz > map->GetLandHeight(posx,posy))//water 
+? ? ? ? ? ? posz = map->GetWaterHeight( posx, posy ); 
+? ? ? ? ? ? if( posz > map->GetLandHeight( posx, posy ) )//water 
? ? ? ? ? ? ? ? break; 
? ? ? ? } 

-? ? ? ? posx=px+r*co; 
-? ? ? ? posy=py+r*si; 
+? ? ? ? posx = px + r * co; 
+? ? ? ? posy = py + r * si; 
? ? ? ?? ? 
-? ? ? ? //check db if there is some fish/loot 
-? ? ? ? //FIX me: this should be loaded/cached 
-? ? ? ? uint32 zone; 
-? ? ? ? ? ? if(!p_caster) 
-? ? ? ? ? ? ? ? zone=dbcArea.LookupEntry(map->GetAreaID(posx,posy))->ZoneId; 
-? ? ? ? ? ? else 
-? ? ? ? ? ? ? ? zone=p_caster->GetZoneId(); 
+? ? ? ? // Todo / Fix me: This should be loaded / cached 
+? ? ? ? uint32 zone = p_caster->GetAreaID(); 
+? ? ? ? if( zone == 0 ) // If the player&#39;s area ID is 0, use the zone ID instead 
+? ? ? ? ? ? zone = p_caster->GetZoneId(); 

? ? ? ? uint32 minskill; 
-? ? ? ? FishingZoneEntry *fishentry = FishingZoneStorage.LookupEntry(zone); 
-? ? ? ? if (!fishentry) 
+? ? ? ? FishingZoneEntry *fishentry = FishingZoneStorage.LookupEntry( zone ); 
+? ? ? ? if( !fishentry ) // Check database if there is fishing area / zone information, if not, return 
? ? ? ? ? ? return; 
? ? ? ? 
-? ? ? ? //TODO: add fishskill to the calculations 
+? ? ? ? // Todo / Fix me: Add fishskill to the calculations 
? ? ? ? minskill = fishentry->MinSkill; 
-? ? ? ? spell->SendChannelStart(20000);//30 seconds 
+? ? ? ? spell->SendChannelStart( 20000 ); // 30 seconds 
? ? ? ? /*spell->SendSpellStart(); 
? ? ? ? spell->SendCastResult(SPELL_CANCAST_OK); 
? ? ? ? spell->SendSpellGo ();*/ 

-? ? ? ? 
-? ? ? ? GameObject *go=u_caster->GetMapMgr()->CreateGameObject(); 
+? ? ? ? GameObject *go = u_caster->GetMapMgr()->CreateGameObject(); 

-? ? ? ? go->CreateFromProto(GO_FISHING_BOBBER,mapid,posx,posy,posz,orient); 
-? ? ? ? go->SetUInt32Value(GAMEOBJECT_FLAGS, 0); 
-? ? ? ? go->SetUInt32Value(GAMEOBJECT_STATE,0); 
-? ? ? ? go->SetUInt64Value(OBJECT_FIELD_CREATED_BY,m_caster->GetGUID()); 
-? ? ? ? u_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT,go->GetGUID()); 
+? ? ? ? go->CreateFromProto( GO_FISHING_BOBBER, mapid, posx, posy, posz, orient ); 
+? ? ? ? go->SetUInt32Value( GAMEOBJECT_FLAGS, 0 ); 
+? ? ? ? go->SetUInt32Value( GAMEOBJECT_STATE, 0 ); 
+? ? ? ? go->SetUInt64Value( OBJECT_FIELD_CREATED_BY, m_caster->GetGUID() ); 
+? ? ? ? u_caster->SetUInt64Value( UNIT_FIELD_CHANNEL_OBJECT, go->GetGUID() ); 
? ? ? ? ? ?? 
-? ? ? ? go->SetInstanceID(m_caster->GetInstanceID()); 
-? ? ? ? go->PushToWorld(m_caster->GetMapMgr()); 
+? ? ? ? go->SetInstanceID( m_caster->GetInstanceID() ); 
+? ? ? ? go->PushToWorld( m_caster->GetMapMgr() ); 
? ?? ? 
-? ? ? ? if (lootmgr.IsFishable(zone)) // only add this if there is fish in that zone. 
+? ? ? ? if( lootmgr.IsFishable( zone ) ) // Only set a &#39;splash&#39; if there is any loot in this area / zone 
? ? ? ? { 
? ? ? ? ? ? uint32 seconds = RandomUInt(17) + 2; 
? ? ? ? ? ? sEventMgr.AddEvent( go, &GameObject::FishHooked, static_cast< Player* >( m_caster ), EVENT_GAMEOBJECT_FISH_HOOKED, seconds * 1000, 1, 0 );


相关报道:

[关闭] [返回顶部]


  返回首页 | 最新资讯 | 资源下载 | 魔兽图片 | 单机文档 | 技术攻略 | 玩家视频
备案号:蜀ICP备2024062380号-1
免责声明:本网站为热爱怀旧WOW的玩家们建立的魔兽世界资料网站,仅供交流和学习使用,非盈利和商用.如有侵权之处,请联系我们,我们会在24小时内确认删除侵权内容,谢谢合作。
Copyright © 2024 - 2024 WOWAII.COM Corporation, All Rights Reserved

机器人国度