📄 zoneutil.cpp
字号:
if (!pZone->getTile(x,y).isBlocked(MMode)) { return true; } } return false; __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 漂沥 困摹俊 滚肺快啊 啊瓷茄瘤 眉农甫 茄促. //// Zone* pZone : 粮俊 措茄 器牢磐// ZoneCoord_t x : 滚肺快窍绊磊 窍绰 谅钎 x// ZoneCoord_t y : 滚肺快窍绊磊 窍绰 谅钎 y//////////////////////////////////////////////////////////////////////////////bool canBurrow(Zone* pZone, ZoneCoord_t x, ZoneCoord_t y) throw(){ __BEGIN_TRY Assert(pZone != NULL); return canAddCreature(pZone, x, y, Creature::MOVE_MODE_BURROWING); __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 漂沥 困摹俊 攫滚肺快啊 啊瓷茄瘤 眉农甫 茄促.//// Zone* pZone : 粮俊 措茄 器牢磐// ZoneCoord_t x : 滚肺快窍绊磊 窍绰 谅钎 x// ZoneCoord_t y : 滚肺快窍绊磊 窍绰 谅钎 y//////////////////////////////////////////////////////////////////////////////bool canUnburrow(Zone* pZone, ZoneCoord_t x, ZoneCoord_t y) throw(){ __BEGIN_TRY Assert(pZone != NULL); return canAddCreature(pZone, x, y, Creature::MOVE_MODE_WALKING); __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 农府媚甫 第肺 拱矾唱霸 茄促.//// Zone* pZone : 粮俊 措茄 器牢磐// Creature* pCreature : 拱矾唱霸 且 农府媚// ZoneCoord_t originX : pCreature甫 拱矾唱霸 茄 惑措规狼 谅钎 x// ZoneCoord_t originY : pCreature甫 拱矾唱霸 茄 惑措规狼 谅钎 y//////////////////////////////////////////////////////////////////////////////Dir_t knockbackCreature(Zone* pZone, Creature* pCreature, ZoneCoord_t originX, ZoneCoord_t originY) throw (ProtocolException, Error){ __BEGIN_TRY Assert(pZone != NULL); Assert(pCreature != NULL); if (pCreature->isDead() || pCreature->isFlag(Effect::EFFECT_CLASS_COMA) || pCreature->isFlag(Effect::EFFECT_CLASS_NO_DAMAGE)) { return UP; } if ( pCreature->isMonster() ) { Monster* pMonster = dynamic_cast<Monster*>(pCreature); if ( pMonster != NULL && pMonster->getMonsterType() == GROUND_ELEMENTAL_TYPE ) return UP;// if ( pMonster->hasRelic() || pMonster->getBrain() == NULL ) return UP; } // 农府媚啊 拱矾朝 谅钎 棺 规氢阑 拌魂茄促. ZoneCoord_t nx = pCreature->getX(); ZoneCoord_t ny = pCreature->getY(); ZoneCoord_t cx = nx; ZoneCoord_t cy = ny; ZoneCoord_t height = pZone->getHeight(); ZoneCoord_t width = pZone->getWidth(); Dir_t dir = calcDirection(originX, originY, nx, ny); Tile& rOriginTile = pZone->getTile(cx, cy); if ( rOriginTile.getEffect(Effect::EFFECT_CLASS_TRYING_POSITION) != NULL ) return UP; // 拱矾朝 谅钎甫 簿魂茄促. switch (dir) { case UP: if ( ny > 0 ) { ny -= 1; } break; case DOWN: if ( ny < (height-1)) { ny += 1; } break; case LEFT: if (nx > 0 ) { nx -= 1; } break; case RIGHT: if (nx < (width - 1) ) { nx += 1; } break; case LEFTUP: if (nx > 0 && ny > 0 ) { nx -= 1; ny -= 1; } break; case RIGHTUP: if (nx < (width - 1) && ny > 0 ) { nx += 1; ny -= 1; } break; case LEFTDOWN: if (nx > 0 && ny < (height-1)) { nx -= 1; ny += 1; } break; case RIGHTDOWN: if (nx < (width - 1) && ny < (height-1)) { nx += 1; ny += 1; } break; } // 包 加俊 乐绰 惑怕啊 酒聪绢具 窍绊 // 档馒瘤痢篮 厚绢 乐绢具窍绊, 农府媚 开矫 框流老 荐 乐绰 惑怕咯具 茄促. Tile& rTargetTile = pZone->getTile(nx, ny); if (!pCreature->isFlag(Effect::EFFECT_CLASS_CASKET) && !rTargetTile.isBlocked(pCreature->getMoveMode()) && !pCreature->isFlag(Effect::EFFECT_CLASS_HIDE) && !rTargetTile.hasPortal()) { pCreature->setX(nx); pCreature->setY(ny); try { // 捞傈 鸥老俊辑 农府媚甫 昏力茄促. rOriginTile.deleteCreature(pCreature->getObjectID()); // 货 鸥老俊 农府媚甫 眠啊茄促. if (!rTargetTile.addCreature(pCreature)) { // Portal阑 activate矫挪 版快捞促. by sigi. 2002.5.6 return dir; } // 瘤汾甫 眉农茄促. try { checkMine(pZone, pCreature, nx, ny); checkTrap(pZone, pCreature); } catch ( Throwable & t ) { filelog("CheckMineBug.txt", "%s : %s", "KnockBackCreature", t.toString().c_str()); } // GCMove/GCAddSlayer/GCAddVampire甫 宏肺靛某胶飘. if (pCreature->isPC()) { pZone->movePCBroadcast(pCreature, cx, cy, nx, ny, false, true); } else { pZone->moveCreatureBroadcast(pCreature, cx, cy, nx, ny, false, true); } } catch (NoSuchElementException& nsee) { throw Error("No creature on previous tile"); } catch (DuplicatedException& de) { throw Error("Thers's a creature on new tile"); } catch (PortalException&) { // 儒儒.. goto 促. } catch (Error& e) { filelog("assertTile.txt", "knockbackCreature : %s", e.toString().c_str()); throw; } } return dir; __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 窍捞靛甫 敬 农府媚甫 粮俊促 眠啊茄促.//// Zone* pZone : 粮俊 措茄 器牢磐// Creature* pCreature : 窍捞靛甫 敬 农府媚// ZoneCoord_t cx : 农府媚狼 盔贰 谅钎 x// ZoneCoord_t cy : 农府媚狼 盔贰 谅钎 y//////////////////////////////////////////////////////////////////////////////void addBurrowingCreature(Zone* pZone, Creature* pCreature, ZoneCoord_t cx, ZoneCoord_t cy) throw (EmptyTileNotExistException, Error){ __BEGIN_TRY Assert(pZone != NULL); Assert(pCreature != NULL); Assert(pCreature->isVampire() || pCreature->isMonster()); TPOINT pt = findSuitablePosition(pZone, cx, cy, Creature::MOVE_MODE_BURROWING); if (pt.x != -1) { pCreature->setFlag(Effect::EFFECT_CLASS_HIDE); Assert(pCreature->getMoveMode() == Creature::MOVE_MODE_WALKING); Tile& oldTile = pZone->getTile(pCreature->getX(), pCreature->getY()); Tile& newTile = pZone->getTile(pt.x, pt.y); try { oldTile.deleteCreature(pCreature->getObjectID()); } catch (Error& e) { filelog("assertTile.txt", "addBurrowingCreature : %s", e.toString().c_str()); throw; } pCreature->setMoveMode(Creature::MOVE_MODE_BURROWING); newTile.addCreature(pCreature); Assert(pCreature == newTile.getCreature(pCreature->getMoveMode())); // 农府媚狼 谅钎甫 函版茄促. pCreature->setXYDir(pt.x, pt.y, pCreature->getDir()); //scanPC(pCreature); //GCDeleteObject gcDO; // 泪矫 持菌带芭.. 促矫 绝据促. by sigi //gcDO.setObjectID(pCreature->getObjectID()); // 林函狼 PC甸俊霸 舅副 GCAddBurrowingCreature GCAddBurrowingCreature gcABC; gcABC.setObjectID(pCreature->getObjectID()); gcABC.setName(pCreature->getName()); gcABC.setX(pt.x); gcABC.setY(pt.y); //-------------------------------------------------------------------------------- // // 矫具 康开狼 惑窍谅快 葛滴 + 1 究 刘啊矫挪促. // 捞蜡绰 规氢俊 蝶弗 ON_SIGHT 康开捞 刘啊登扁 锭巩捞促. // //-------------------------------------------------------------------------------- // 泪矫 持菌带芭 促矫 绝据促. by sigi /* for (ZoneCoord_t ix = max(0, cx - maxViewportWidth - 1), endx = min(pZone->getWidth() - 1, cx + maxViewportWidth + 1) ; ix <= endx ; ix ++) { for (ZoneCoord_t iy = max(0, cy - maxViewportUpperHeight - 1), endy = min(pZone->getHeight() - 1, cy + maxViewportLowerHeight + 1) ; iy <= endy ; iy ++) { Tile& curTile = pZone->getTile(ix, iy); const slist<Object*> & objectList = curTile.getObjectList(); slist<Object*>::const_iterator itr = objectList.begin(); for (; itr != objectList.end() && (*itr)->getObjectPriority() <= OBJECT_PRIORITY_BURROWING_CREATURE; itr ++) { Assert(*itr != NULL); Creature* pViewer= dynamic_cast<Creature*>(*itr); if (pViewer != pCreature && pViewer->isPC() && (pViewer->getVisionState(cx, cy) >= IN_SIGHT)) { if (pViewer->isSlayer() && !pViewer->isFlag(Effect::EFFECT_CLASS_DETECT_HIDDEN)) { // slayer捞绊 detect_hidden档 绝栏搁 GCDeleteObject pViewer->getPlayer()->sendPacket(&gcDO); } else { // vampire捞芭唱.. detect_hidden捞 乐促搁 GCAddBurrowingCreature pViewer->getPlayer()->sendPacket(&gcABC); } }//if }//for }//for }//for */ // broadcastPacket郴何俊辑 杭荐 乐绰瘤甫 贸府窍歹扼.. pZone->broadcastPacket(pt.x, pt.y, &gcABC, pCreature); } else throw EmptyTileNotExistException("addBurrowingCreature() : Tile is not empty."); __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 窍捞靛甫 乾 农府媚甫 粮俊促 眠啊茄促.//// Zone* pZone : 粮俊 措茄 器牢磐// Creature* pCreature : 窍捞靛甫 乾 农府媚// ZoneCoord_t cx : 农府媚狼 盔贰 谅钎 x// ZoneCoord_t cy : 农府媚狼 盔贰 谅钎 y// Dir_t dir : 唱柯 农府媚啊 氢且 规氢//////////////////////////////////////////////////////////////////////////////void addUnburrowCreature(Zone* pZone, Creature* pCreature, ZoneCoord_t cx, ZoneCoord_t cy, Dir_t dir) throw (EmptyTileNotExistException, Error){ __BEGIN_TRY Assert(pZone != NULL); Assert(pCreature != NULL); Assert(pCreature->isFlag(Effect::EFFECT_CLASS_HIDE)); TPOINT pt = findSuitablePosition(pZone, cx, cy, Creature::MOVE_MODE_WALKING); if (pt.x != -1) { ZoneCoord_t oldX = pCreature->getX(); ZoneCoord_t oldY = pCreature->getY(); Tile& oldTile = pZone->getTile(oldX, oldY); Tile& newTile = pZone->getTile(pt.x, pt.y); // 捞傈 困摹俊辑 见菌绰单档 杭 荐 乐绰 仇篮 Delete object甫 焊辰促. GCDeleteObject gcDO; gcDO.setObjectID(pCreature->getObjectID()); pZone->broadcastPacket(oldX, oldY, &gcDO, pCreature); // DeleteObject packet阑 焊辰饶 set. pCreature->removeFlag(Effect::EFFECT_CLASS_HIDE); // 烤朝 鸥老俊辑 农府媚甫 瘤快绊, // 货 鸥老俊 公宏葛靛甫 官层辑 眠啊茄促. try { oldTile.deleteCreature(pCreature->getObjectID()); } catch (Error& e) { filelog("assertTile.txt", "addUnburrowCreature : %s", e.toString().c_str()); throw; } pCreature->setMoveMode(Creature::MOVE_MODE_WALKING); newTile.addCreature(pCreature); Assert(pCreature == newTile.getCreature(pCreature->getMoveMode())); // 农府贸狼 谅钎甫 瘤沥茄促. pCreature->setXYDir(pt.x, pt.y, dir); //scanPC(pCreature); Creature::CreatureClass CClass = pCreature->getCreatureClass(); if (CClass == Creature::CREATURE_CLASS_VAMPIRE) { // 林函狼 PC甸俊霸 轨颇捞绢甫 眠啊窍档废 茄促. Vampire* pVampire = dynamic_cast<Vampire*>(pCreature); GCAddVampireFromBurrowing gcAVFB(pVampire->getVampireInfo3()); gcAVFB.setEffectInfo(pVampire->getEffectInfo()); pZone->broadcastPacket(pt.x, pt.y, &gcAVFB, pCreature); // 顶俊辑 肋 唱吭促绊, 夯牢俊霸 焊郴霖促. GCUnburrowOK gcUnburrowOK(pt.x, pt.y, dir); Player* pPlayer = pCreature->getPlayer(); GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer); pGamePlayer->sendPacket(&gcUnburrowOK); } else if (CClass == Creature::CREATURE_CLASS_MONSTER) { Monster* pMonster = dynamic_cast<Monster*>(pCreature); GCAddMonsterFromBurrowing gcAMFB; gcAMFB.setObjectID(pMonster->getObjectID()); gcAMFB.setMonsterType(pMonster->getMonsterType()); gcAMFB.setMonsterName(pMonster->getMonsterName()); gcAMFB.setX(pt.x); gcAMFB.setY(pt.y); gcAMFB.setDir(dir); gcAMFB.setEffectInfo(pMonster->getEffectInfo()); gcAMFB.setCurrentHP(pMonster->getHP()); gcAMFB.setMaxHP(pMonster->getHP(ATTR_MAX)); pZone->broadcastPacket(pt.x, pt.y, &gcAMFB); } else { throw Error("invalid creature type"); } } else { // 利寸茄 磊府甫 茫瘤 给秦, // 顶俊辑 唱坷瘤 给沁促绊 夯牢俊霸 焊郴霖促. if (pCreature->isPC()) { GCUnburrowFail gcUnburrowFail; pCreature->getPlayer()->sendPacket(&gcUnburrowFail); } else { cerr << "addUnburrowCreature() : Cannot find suitable position" << endl; throw Error("Cannot unburrow monster."); } } __END_CATCH} //////////////////////////////////////////////////////////////////////////////// 函脚阑 乾 农府媚甫 粮俊促 眠啊茄促.//// Zone* pZone : 粮俊 措茄 器牢磐// Creature* pCreature : 函脚阑 乾 农府媚// bool bForce : 捞棋飘狼 duration捞 父扁啊 登瘤 臼疽绰单,// 碍力肺 仟绰 巴牢啊?//////////////////////////////////////////////////////////////////////////////void addUntransformCreature(Zone* pZone, Creature* pCreature, bool bForce) throw(){ __BEGIN_TRY __BEGIN_DEBUG Assert(pZone != NULL); Assert(pCreature != NULL); // 泅犁 函脚 惑怕啊 嘎绰瘤 眉农甫 茄促. Assert(pCreature->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF) || pCreature->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_BAT) || pCreature->isFlag(Effect::EFFECT_CLASS_SUMMON_SYLPH) || pCreature->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WERWOLF)); ZoneCoord_t cx = pCreature->getX(); ZoneCoord_t cy = pCreature->getY(); TPOINT pt = findSuitablePosition(pZone, cx, cy, Creature::MOVE_MODE_WALKING); if (pt.x != -1) { Range_t rangeDiff = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -