吾爱尚玩资源基地
标题:
魔兽世界私服网一个钓鱼的补丁代码
[打印本页]
作者:
admin
时间:
2016-4-19 22:59
标题:
魔兽世界私服网一个钓鱼的补丁代码
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'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 'splash' 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 );
作者:
你懂的
时间:
2016-11-15 08:03
找了好久终于找到了!吾爱尚玩免费服务端下载!
欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/)
Powered by Discuz! X3.4