From: <wel...@us...> - 2011-02-08 09:43:40
|
Revision: 6897 http://planeshift.svn.sourceforge.net/planeshift/?rev=6897&view=rev Author: weltall2 Date: 2011-02-08 09:43:34 +0000 (Tue, 08 Feb 2011) Log Message: ----------- reduce code duplication Modified Paths: -------------- trunk/src/server/npcmanager.cpp Modified: trunk/src/server/npcmanager.cpp =================================================================== --- trunk/src/server/npcmanager.cpp 2011-02-08 09:37:12 UTC (rev 6896) +++ trunk/src/server/npcmanager.cpp 2011-02-08 09:43:34 UTC (rev 6897) @@ -1380,7 +1380,7 @@ //TODO: Add a range check MathEnvironment env; - env.Define("Skill", owner->GetCharacterData()->GetSkillRank(petSkill->getValueAsInt()).Current()); + env.Define("Skill", owner->GetCharacterData()->GetSkillRank(GetPetSkill()).Current()); petRangeScript->Evaluate(&env); MathVar *varMaxRange = env.Lookup("MaxRange"); float max_range = varMaxRange->GetValue(); @@ -1404,7 +1404,7 @@ bool NPCManager::WillPetReact(int clientnum, Client * owner, gemNPC * pet, const char * type, int level) { MathEnvironment env; - env.Define("Skill", owner->GetCharacterData()->GetSkillRank(petSkill->getValueAsInt()).Current()); + env.Define("Skill", owner->GetCharacterData()->GetSkillRank(GetPetSkill()).Current()); env.Define("Level", level); petReactScript->Evaluate(&env); MathVar *varReact = env.Lookup("React"); @@ -1506,7 +1506,7 @@ pet->SetTarget( owner->GetActor() ); } QueueOwnerCmdPerception( owner->GetActor(), pet, psPETCommandMessage::CMD_FOLLOW ); - owner->GetCharacterData()->Skills().AddSkillPractice(petSkill->getValueAsInt(), 1); + owner->GetCharacterData()->Skills().AddSkillPractice(GetPetSkill(), 1); } } else @@ -1521,7 +1521,7 @@ if (CanPetHearYou(me->clientnum, owner, pet, typeStr) && WillPetReact(me->clientnum, owner, pet, typeStr, 1)) { QueueOwnerCmdPerception( owner->GetActor(), pet, psPETCommandMessage::CMD_STAY ); - owner->GetCharacterData()->Skills().AddSkillPractice(petSkill->getValueAsInt(), 1); + owner->GetCharacterData()->Skills().AddSkillPractice(GetPetSkill(), 1); } } else @@ -1642,7 +1642,7 @@ owner->SetFamiliar( pet ); // Send OwnerActionLogon Perception pet->SetOwner( owner->GetActor() ); - owner->GetCharacterData()->Skills().AddSkillPractice(petSkill->getValueAsInt(), 1); + owner->GetCharacterData()->Skills().AddSkillPractice(GetPetSkill(), 1); // Have the pet auto follow when summoned // If no target target owner if (!pet->GetTarget()) @@ -1706,7 +1706,7 @@ stance.stance_id = words.GetInt( 0 ); } QueueOwnerCmdPerception( owner->GetActor(), pet, psPETCommandMessage::CMD_ATTACK ); - owner->GetCharacterData()->Skills().AddSkillPractice(petSkill->getValueAsInt(), 1); + owner->GetCharacterData()->Skills().AddSkillPractice(GetPetSkill(), 1); } } else @@ -1727,7 +1727,7 @@ if (CanPetHearYou(me->clientnum, owner, pet, typeStr) && WillPetReact(me->clientnum, owner, pet, typeStr, 4)) { QueueOwnerCmdPerception( owner->GetActor(), pet, psPETCommandMessage::CMD_STOPATTACK ); - owner->GetCharacterData()->Skills().AddSkillPractice(petSkill->getValueAsInt(), 1); + owner->GetCharacterData()->Skills().AddSkillPractice(GetPetSkill(), 1); } } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |