![]() |
|
Change merchant setting - Printable Version +- LCKB (https://lckb.dev/forum) +-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109) +--- Forum: Guides & Help Section (https://lckb.dev/forum/forumdisplay.php?fid=193) +---- Forum: Tutorials & Guides (https://lckb.dev/forum/forumdisplay.php?fid=124) +----- Forum: Ep4 Guides (https://lckb.dev/forum/forumdisplay.php?fid=125) +----- Thread: Change merchant setting (/showthread.php?tid=2758) |
- rondo157 - 01-03-2021 Server side: GameServer/doFuncExSubJob.cpp #include "stdhdrs.h" #include "Log.h" #include "Character.h" #include "Server.h" #include "CmdMsg.h" #include "doFunc.h" #ifdef ENABLE_SUBJOB void do_ExFuncSubJob( CPC* ch, CNetMsg::SP& msg ) { unsigned char subtype; RefMsg(msg) >> subtype; switch(subtype) { case MSG_EX_SUBJOB_REGIST: do_ExSubJobRegist( ch, msg ); break; } } void do_ExSubJobRegist( CPC* ch, CNetMsg::SP& msg ) { int subjob = 0; RefMsg(msg) >> subjob; int needMinLevel = 0; // min lvl int needMaxLevel = 999; // max lvl int needFame = 0; // fame int needSP = 0 * 10000 ; //Skill Points LONGLONG needMoney = 1; // gold if( !ch ) return; if( ch->m_level < needMinLevel || ch->m_level > needMaxLevel ) { CNetMsg::SP rmsg(new CNetMsg); SubJobErrorMsg(rmsg, 1 ); // ·№є§АМ ёВБц ѕКАЅ SEND_Q( rmsg, ch->m_desc ); return; } if( ch->m_skillPoint < needSP ) { CNetMsg::SP rmsg(new CNetMsg); SubJobErrorMsg(rmsg, 3 ); // јч·Гµµ ёрАЪ¶ч SEND_Q( rmsg, ch->m_desc ); return; } if( ch->m_fame < needFame ) { CNetMsg::SP rmsg(new CNetMsg); SubJobErrorMsg(rmsg, 2 ); // ёнјєДЎ ёрАЪ¶ч SEND_Q( rmsg, ch->m_desc ); return; } // µ· Вч°Ё if (ch->m_inventory.getMoney() < needMoney) { CNetMsg::SP rmsg(new CNetMsg); SubJobErrorMsg(rmsg, 4 ); // іЄЅєєОБ· SEND_Q( rmsg, ch->m_desc ); return ; } else { ch->m_inventory.decreaseMoney(needMoney); } // јч·Гµµ Вч°Ё ch->m_skillPoint -= needSP ; // ёнјєДЎ Вч°Ё ch->m_fame -= needFame; // »уАОµо·П ch->m_jobSub |= subjob ; ch->CalcStatus(true); // јє°шёЮјјБц CNetMsg::SP rmsg(new CNetMsg); SubJobMsg(rmsg, MSG_EX_SUBJOB_ERROR_SUCESS ); RefMsg(rmsg) << subjob; SEND_Q( rmsg, ch->m_desc ); return; } #endif // ENABLE_SUBJOB // |