📄 actionsimplequestregen.cpp
字号:
////////////////////////////////////////////////////////////////////////////////// Filename : ActionSimpleQuestRegen.cpp// Written By : // Description : // 惑痢 NPC甫 力老 贸澜 肺爹且 锭, 惑痢 NPC啊 迫霸 瞪 酒捞袍阑// 霖厚窍绰 咀记捞促. ShopTemplate 努贰胶客 概聪历甫 曼绊且 巴.////////////////////////////////////////////////////////////////////////////////#include "ActionSimpleQuestRegen.h"#include "Creature.h"#include "NPC.h"#include "GamePlayer.h"#include <stdlib.h>#include <stdio.h>#include <math.h>#include <vector>////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////ActionSimpleQuestRegen::ActionSimpleQuestRegen() throw(){ __BEGIN_TRY m_Period.tv_sec = 0; m_Period.tv_usec = 0; m_NextRegen.tv_sec = 0; m_NextRegen.tv_usec = 0; __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////ActionSimpleQuestRegen::~ActionSimpleQuestRegen() throw(){ __BEGIN_TRY __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void ActionSimpleQuestRegen::read (PropertyBuffer & propertyBuffer) throw (Error){ __BEGIN_TRY try { //int m_Num = propertyBuffer.getPropertyInt("Num"); // 惑痢 诀单捞飘 林扁甫 佬绢甸牢促. (檬 窜困) int nSecond = propertyBuffer.getPropertyInt("Period"); m_Period.tv_sec = nSecond; // 促澜 惑痢 诀单捞飘甫 攫力 且 巴牢啊甫 技泼秦 霖促. Timeval currentTime; getCurrentTime(currentTime); m_NextRegen = currentTime; } catch (NoSuchElementException & nsee) { throw Error(nsee.toString()); } __END_CATCH}////////////////////////////////////////////////////////////////////////////////// 咀记阑 角青茄促.// NOTE : ShopTemplate篮 捞 咀记捞 角青登扁 傈俊 葛滴 肺靛登绢 乐绢具 茄促.////////////////////////////////////////////////////////////////////////////////void ActionSimpleQuestRegen::execute (Creature * pCreature1 , Creature * pCreature2) throw (Error){ __BEGIN_TRY/* Assert(pCreature1 != NULL); Assert(pCreature1->isNPC()); NPC* pNPC = dynamic_cast<NPC*>(pCreature1); Assert(pNPC != NULL); Zone* pZone = pNPC->getZone(); Assert(pZone != NULL); // 泅犁 矫埃阑 掘绢辰促. Timeval currentTime; getCurrentTime(currentTime); // 诀单捞飘且 矫埃捞 酒流 登流 臼疽促搁 傲 府畔茄促. if (currentTime < m_NextRegen) return; // 林困俊 NPC尔 捞具扁窍绊 乐绰 敲饭捞绢啊 绝绰瘤 刚历 八荤茄促. VSRect rect(0, 0, pZone->getWidth()-1, pZone->getHeight()-1); int centerX = pNPC->getX(); int centerY = pNPC->getY(); try { for (int zx = centerX - 5; zx <= centerX+5; zx++) { for (int zy = centerY - 5; zy <= centerY+5; zy++) { // 谅钎啊 茄拌甫 逞绢啊瘤 臼疽绰瘤 眉农... if (!rect.ptInRect(zx, zy)) { continue; } Tile& tile = pZone->getTile(zx, zy); // 吧绢促聪绰 农府媚甫 八祸 if (tile.hasCreature(Creature::MOVE_MODE_WALKING)) { Creature* pNearCreature = tile.getCreature(Creature::MOVE_MODE_WALKING); Assert(pNearCreature != NULL); // NPC尔 捞具扁窍绊 乐绰 仇捞 乐栏搁 傲 府畔 if (pNearCreature->isPC()) { return; } } // 朝酒促聪绰 农府媚甫 八祸 if (tile.hasCreature(Creature::MOVE_MODE_FLYING)) { Creature* pNearCreature = tile.getCreature(Creature::MOVE_MODE_FLYING); Assert(pNearCreature != NULL); // NPC尔 捞具扁窍绊 乐绰 仇捞 乐栏搁 傲 府畔 if (pNearCreature->isPC()) { return; } } } } } catch (Throwable & t) { filelog("questBUG.txt", "%s", t.toString().c_str()); return; } try { pNPC->regenSimpleQuest(); } catch (Error& t) { // 俊矾绰 促矫 带柳促. filelog("regenQuestBug.txt", "%s", t.toString().c_str()); throw; } catch (Throwable& t) { filelog("regenQuestBug.txt", "%s", t.toString().c_str()); } // 促澜 诀单捞飘且 矫埃阑 沥秦霖促. m_NextRegen = m_NextRegen + m_Period;*/ __END_CATCH}////////////////////////////////////////////////////////////////////////////////// get debug string////////////////////////////////////////////////////////////////////////////////string ActionSimpleQuestRegen::toString () const throw (){ __BEGIN_TRY StringStream msg; msg << "ActionSimpleQuestRegen()"; return msg.toString(); __END_CATCH}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -