📄 transformtowolf.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : TransformToWolf.cpp// Written by : elca@ewestsoft.com// Description : //////////////////////////////////////////////////////////////////////////////#include "TransformToWolf.h"#include "EffectTransformToWolf.h"#include "ItemUtil.h"#include "RankBonus.h"#include "PKZoneInfoManager.h"#include "CreatureUtil.h"#include "GamePlayer.h"#include "Gpackets/GCSkillToSelfOK1.h"#include "Gpackets/GCSkillToInventoryOK1.h"#include "Gpackets/GCSkillToSelfOK3.h"#include "Gpackets/GCDeleteObject.h"#include "Gpackets/GCAddWolf.h"//////////////////////////////////////////////////////////////////////////////// 轨颇捞绢 牢亥配府 勤甸矾//////////////////////////////////////////////////////////////////////////////void TransformToWolf::execute(Vampire* pVampire, ObjectID_t InvenObjectID, CoordInven_t X, CoordInven_t Y, CoordInven_t TargetX, CoordInven_t TargetY, VampireSkillSlot* pSkillSlot) throw(Error){ __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl; Assert(pVampire != NULL); Assert(pSkillSlot != NULL); try { Player* pPlayer = pVampire->getPlayer(); Zone* pZone = pVampire->getZone(); Inventory* pInventory = pVampire->getInventory(); Assert(pPlayer != NULL); Assert(pZone != NULL); Assert(pInventory!= NULL); Item* pItem = pInventory->getItem(X, Y); Assert(pItem != NULL); // 利寸茄 酒捞袍捞 酒聪扼搁 寸楷洒 函脚且 荐 绝促. // PK粮俊辑绰 函脚且 荐 绝促. if (pItem->getItemClass() != Item::ITEM_CLASS_VAMPIRE_ETC || pItem->getItemType() != 0 || pVampire->hasRelicItem() || g_pPKZoneInfoManager->isPKZone( pZone->getZoneID() ) || pVampire->isFlag( Effect::EFFECT_CLASS_REFINIUM_TICKET ) ) { executeSkillFailException(pVampire, getSkillType()); //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; return; } GCSkillToInventoryOK1 _GCSkillToInventoryOK1; SkillType_t SkillType = pSkillSlot->getSkillType(); SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); ZoneCoord_t x = pVampire->getX(); ZoneCoord_t y = pVampire->getY(); // Knowledge of Innate 啊 乐促搁 hit bonus 10 int HitBonus = 0; if ( pVampire->hasRankBonus( RankBonus::RANK_BONUS_KNOWLEDGE_OF_INNATE ) ) { RankBonus* pRankBonus = pVampire->getRankBonus( RankBonus::RANK_BONUS_KNOWLEDGE_OF_INNATE ); Assert( pRankBonus != NULL ); HitBonus = pRankBonus->getPoint(); } int RequiredMP = decreaseConsumeMP(pVampire, pSkillInfo); bool bManaCheck = hasEnoughMana(pVampire, RequiredMP); bool bTimeCheck = verifyRunTime(pSkillSlot); bool bRangeCheck = checkZoneLevelToUseSkill(pVampire); bool bHitRoll = HitRoll::isSuccessMagic(pVampire, pSkillInfo, pSkillSlot, HitBonus); bool bMoveModeCheck = pVampire->isWalking(); bool bEffected = pVampire->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF) || pVampire->isFlag(Effect::EFFECT_CLASS_HAS_FLAG) || pVampire->isFlag(Effect::EFFECT_CLASS_HAS_SWEEPER); if (bManaCheck && bTimeCheck && bRangeCheck && bHitRoll && bMoveModeCheck && !bEffected) { decreaseMana(pVampire, RequiredMP, _GCSkillToInventoryOK1); SkillInput input(pVampire); SkillOutput output; computeOutput(input, output); // 捞棋飘 努贰胶甫 父甸绢 嘿牢促. EffectTransformToWolf* pEffectTTW = new EffectTransformToWolf(pVampire); pEffectTTW->setDeadline(999999999); pVampire->addEffect(pEffectTTW); pVampire->setFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF); // 捞肺 牢秦辑 函窍绰 瓷仿摹甸阑 焊郴霖促. VAMPIRE_RECORD prev; pVampire->getVampireRecord(prev); pVampire->initAllStat(); pVampire->addModifyInfo(prev, _GCSkillToInventoryOK1); _GCSkillToInventoryOK1.setSkillType(SkillType); _GCSkillToInventoryOK1.setCEffectID(0); _GCSkillToInventoryOK1.setDuration(0); pPlayer->sendPacket(&_GCSkillToInventoryOK1); // 轨颇捞绢 措脚 戳措甫 歹窍扼绊 舅妨霖促. GCAddWolf gcAddWolf; gcAddWolf.setObjectID(pVampire->getObjectID()); gcAddWolf.setName(pVampire->getName()); gcAddWolf.setXYDir(x, y, pVampire->getDir()); gcAddWolf.setItemType(pItem->getItemType()); gcAddWolf.setCurrentHP(pVampire->getHP()); gcAddWolf.setMaxHP(pVampire->getHP(ATTR_MAX)); gcAddWolf.setGuildID(pVampire->getGuildID()); pZone->broadcastPacket(x, y, &gcAddWolf, pVampire); decreaseItemNum(pItem, pInventory, pVampire->getName(), STORAGE_INVENTORY, 0, X, Y); if ( pVampire->getPetInfo() != NULL ) { pVampire->setPetInfo(NULL); sendPetInfo( dynamic_cast<GamePlayer*>(pVampire->getPlayer()), true ); } pSkillSlot->setRunTime(output.Delay); } else { executeSkillFailNormal(pVampire, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pVampire, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 阁胶磐 伎橇 勤甸矾//////////////////////////////////////////////////////////////////////////////void TransformToWolf::execute(Monster* pMonster) throw(Error){ __BEGIN_TRY //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " Begin" << endl; Assert(pMonster != NULL); try { Zone* pZone = pMonster->getZone(); Assert(pZone != NULL); SkillType_t SkillType = SKILL_TRANSFORM_TO_WOLF; SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType); ZoneCoord_t x = pMonster->getX(); ZoneCoord_t y = pMonster->getY(); bool bRangeCheck = checkZoneLevelToUseSkill(pMonster); bool bHitRoll = HitRoll::isSuccessMagic(pMonster, pSkillInfo); bool bMoveModeCheck = pMonster->isWalking(); bool bEffected = pMonster->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF); if (bRangeCheck && bHitRoll && bMoveModeCheck && !bEffected) { SkillInput input(pMonster); SkillOutput output; computeOutput(input, output); // 捞棋飘 努贰胶甫 父甸绢 嘿牢促. EffectTransformToWolf* pEffectTTW = new EffectTransformToWolf(pMonster); pEffectTTW->setDeadline(999999999); pMonster->addEffect(pEffectTTW); pMonster->setFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF); // 捞肺 牢秦辑 函窍绰 瓷仿摹甸阑 焊郴霖促. pMonster->initAllStat(); // 轨颇捞绢 措脚 戳措甫 歹窍扼绊 舅妨霖促. GCAddWolf gcAddWolf; gcAddWolf.setObjectID(pMonster->getObjectID()); gcAddWolf.setName(pMonster->getName()); gcAddWolf.setXYDir(x, y, pMonster->getDir()); gcAddWolf.setItemType(0); gcAddWolf.setCurrentHP(pMonster->getHP()); gcAddWolf.setMaxHP(pMonster->getHP(ATTR_MAX)); gcAddWolf.setGuildID(1); pZone->broadcastPacket(x, y, &gcAddWolf, pMonster); } else { executeSkillFailNormal(pMonster, getSkillType(), NULL); } } catch(Throwable & t) { executeSkillFailException(pMonster, getSkillType()); } //cout << "TID[" << Thread::self() << "]" << getSkillHandlerName() << " End" << endl; __END_CATCH}TransformToWolf g_TransformToWolf;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -