📄 actionsearchmotorcycle.cpp
字号:
////////////////////////////////////////////////////////////////////////////////// Filename : ActionSearchMotorcycle.cpp// Written By : // Description :////////////////////////////////////////////////////////////////////////////////#include "ActionSearchMotorcycle.h"#include "Creature.h"#include "NPC.h"#include "GamePlayer.h"#include "Slayer.h"#include "item/Key.h"#include "Gpackets/GCNPCResponse.h"#include "Gpackets/GCSearchMotorcycleOK.h"#include "Gpackets/GCSearchMotorcycleFail.h"#include "ParkingCenter.h"#include "DB.h"////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void ActionSearchMotorcycle::read (PropertyBuffer & propertyBuffer) throw (Error){ __BEGIN_TRY __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void ActionSearchMotorcycle::execute (Creature * pCreature1 , Creature* pCreature2) throw (Error){ __BEGIN_TRY Assert(pCreature1 != NULL); Assert(pCreature2 != NULL); Assert(pCreature1->isNPC()); Assert(pCreature2->isPC()); Player* pPlayer = pCreature2->getPlayer(); Assert(pPlayer != NULL); // 老窜 努扼捞攫飘甫 困秦 ok菩哦阑 窍唱 朝妨林绊... GCNPCResponse answerOKpkt; pPlayer->sendPacket(&answerOKpkt); // 敲饭捞绢啊 浇饭捞绢牢瘤 八荤茄促. if (pCreature2->isSlayer()) { Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature2); Inventory* pInventory = pSlayer->getInventory(); uint InvenWidth = pInventory->getWidth(); uint InvenHeight = pInventory->getHeight(); Item* pItem = NULL; uint motorZoneID = 0; uint motorX = 0; uint motorY = 0; // 牢亥配府甫 八祸茄促. for (uint y=0; y<InvenHeight; y++) { for (uint x=0; x<InvenWidth; x++) { // x, y俊 酒捞袍捞 乐促搁... if (pInventory->hasItem(x, y)) { pItem = pInventory->getItem(x, y); if (search(pItem, motorZoneID, motorX, motorY)) { GCSearchMotorcycleOK okpkt; okpkt.setZoneID(motorZoneID); okpkt.setX(motorX); okpkt.setY(motorY); pPlayer->sendPacket(&okpkt); return; } } } } } else // 轨颇捞绢扼搁...坷配官捞甫 茫酒临 捞蜡啊 乐阑鳖? { } GCSearchMotorcycleFail failpkt; pPlayer->sendPacket(&failpkt); __END_CATCH}bool ActionSearchMotorcycle::search(Item* pItem, uint& zoneid, uint& x, uint& y) const throw(){ __BEGIN_TRY bool bFound = false; // 窜辑啊 登绰 酒捞袍捞 虐啊 酒聪扼搁 false甫 府畔. if (pItem->getItemClass() != Item::ITEM_CLASS_KEY) return false; // 虐啊 嘎促搁 虐狼 鸥百捞 登绰 酒捞袍狼 酒捞袍 ID甫 掘绢辰促. DWORD targetID = dynamic_cast<Key*>(pItem)->getTarget(); // 秦寸窍绰 坷配官捞啊 粮犁窍绰瘤 眉农甫 茄促. if (g_pParkingCenter->hasMotorcycleBox(targetID)) { MotorcycleBox* pBox = g_pParkingCenter->getMotorcycleBox(targetID); Assert(pBox != NULL); zoneid = pBox->getZone()->getZoneID(); x = pBox->getX(); y = pBox->getY(); bFound = true; } return bFound; __END_CATCH}////////////////////////////////////////////////////////////////////////////////// get debug string////////////////////////////////////////////////////////////////////////////////string ActionSearchMotorcycle::toString () const throw (){ __BEGIN_TRY StringStream msg; msg << "ActionSearchMotorcycle(" << ")"; return msg.toString(); __END_CATCH}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -