cgpetgamblehandler.cpp
来自「天之炼狱1服务器端源文件游戏服务端不完整」· C++ 代码 · 共 67 行
CPP
67 行
//////////////////////////////////////////////////////////////////////////////// Filename : CGPetGambleHandler.cc// Written By : elca@ewestsoft.com// Description ://////////////////////////////////////////////////////////////////////////////#include "CGPetGamble.h"#ifdef __GAME_SERVER__#include "GamePlayer.h"#include "PlayerCreature.h"#include "PetInfo.h"#include "CreatureUtil.h"#include "PetItem.h"#endif////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void CGPetGambleHandler::execute (CGPetGamble* pPacket , Player* pPlayer) throw (ProtocolException, Error){ __BEGIN_TRY __BEGIN_DEBUG_EX#ifdef __GAME_SERVER__ cout << "脐 胺喉窃聪寸" << endl; GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer); Assert( pGamePlayer != NULL ); PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGamePlayer->getCreature()); Assert( pPC != NULL ); PetInfo* pPetInfo = pPC->getPetInfo(); if ( pPetInfo == NULL ) return; if ( !pPetInfo->canGamble() ) return; int value = rand()%100; pPetInfo->setGamble(0); cout << value << endl; if ( value < pPetInfo->getPetLevel() ) { if ( !pPetInfo->canCutHead() ) { pPetInfo->setCutHead(1); if ( pPetInfo->getPetType() > 2 && pPetInfo->getPetLevel() >= 30 ) pPetInfo->setGamble(1); } else if ( pPetInfo->getPetType() > 2 ) { pPetInfo->setAttack(1); }// cout << "胺喉 己傍!" << endl; } pPetInfo->getPetItem()->savePetInfo(); sendPetInfo( pGamePlayer, false );#endif // __GAME_SERVER__ __END_DEBUG_EX __END_CATCH}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?