#include "stdafx.h" #include "utils.h" #include "config.h" #include "desc_client.h" #include "desc_manager.h" #include "char.h" #include "char_manager.h" #include "item_manager.h" #include "sectree_manager.h" #include "mob_manager.h" #include "packet.h" #include "cmd.h" #include "regen.h" #include "guild.h" #include "guild_manager.h" #include "p2p.h" #include "buffer_manager.h" #include "fishing.h" #include "mining.h" #include "questmanager.h" #include "vector.h" #include "affect.h" #include "db.h" #include "priv_manager.h" #include "building.h" #include "battle.h" #include "arena.h" #include "start_position.h" #include "party.h" #include "monarch.h" #include "castle.h" #include "BattleArena.h" #include "xmas_event.h" #include "log.h" #include "pcbang.h" #include "threeway_war.h" #include "unique_item.h" #include "DragonSoul.h" extern bool DropEvent_RefineBox_SetValue(const std::string& name, int value); // ADD_COMMAND_SLOW_STUN enum { COMMANDAFFECT_STUN, COMMANDAFFECT_SLOW, }; void Command_ApplyAffect(LPCHARACTER ch, const char* argument, const char* affectName, int cmdAffect) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); sys_log(0, arg1); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: %s ", affectName); return; } LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1); if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "%s is not in same map", arg1); return; } switch (cmdAffect) { case COMMANDAFFECT_STUN: SkillAttackAffect(tch, 1000, IMMUNE_STUN, AFFECT_STUN, POINT_NONE, 0, AFF_STUN, 30, "GM_STUN"); break; case COMMANDAFFECT_SLOW: SkillAttackAffect(tch, 1000, IMMUNE_SLOW, AFFECT_SLOW, POINT_MOV_SPEED, -30, AFF_SLOW, 30, "GM_SLOW"); break; } sys_log(0, "%s %s", arg1, affectName); ch->ChatPacket(CHAT_TYPE_INFO, "%s %s", arg1, affectName); } // END_OF_ADD_COMMAND_SLOW_STUN ACMD(do_pcbang_update) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); unsigned long PCBangID = 0; if (*arg1 == '\0') PCBangID = 0; else str_to_number(PCBangID, arg1); if (PCBangID == 0) { CPCBangManager::instance().RequestUpdateIPList(0); ch->ChatPacket(CHAT_TYPE_INFO, "PCBang Info Update For All"); } else { CPCBangManager::instance().RequestUpdateIPList(PCBangID); ch->ChatPacket(CHAT_TYPE_INFO, "PCBang Info Update For %u", PCBangID); } TPacketPCBangUpdate packet; packet.bHeader = HEADER_GG_PCBANG_UPDATE; packet.ulPCBangID = PCBangID; P2P_MANAGER::instance().Send(&packet, sizeof(TPacketPCBangUpdate)); } ACMD(do_pcbang_check) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (CPCBangManager::instance().IsPCBangIP(arg1) == true) { ch->ChatPacket(CHAT_TYPE_INFO, "%s is a PCBang IP", arg1); } else { ch->ChatPacket(CHAT_TYPE_INFO, "%s is not a PCBang IP", arg1); } } ACMD(do_stun) { Command_ApplyAffect(ch, argument, "stun", COMMANDAFFECT_STUN); } ACMD(do_slow) { Command_ApplyAffect(ch, argument, "slow", COMMANDAFFECT_SLOW); } ACMD(do_transfer) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: transfer "); return; } LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1); if (!tch) { CCI * pkCCI = P2P_MANAGER::instance().Find(arg1); if (pkCCI) { if (pkCCI->bChannel != g_bChannel) { ch->ChatPacket(CHAT_TYPE_INFO, "Target is in %d channel (my channel %d)", pkCCI->bChannel, g_bChannel); return; } TPacketGGTransfer pgg; pgg.bHeader = HEADER_GG_TRANSFER; strlcpy(pgg.szName, arg1, sizeof(pgg.szName)); pgg.lX = ch->GetX(); pgg.lY = ch->GetY(); P2P_MANAGER::instance().Send(&pgg, sizeof(TPacketGGTransfer)); ch->ChatPacket(CHAT_TYPE_INFO, "Transfer requested."); } else { ch->ChatPacket(CHAT_TYPE_INFO, "There is no character(%s) by that name", arg1); sys_log(0, "There is no character(%s) by that name", arg1); } return; } if (ch == tch) { ch->ChatPacket(CHAT_TYPE_INFO, "Transfer me?!?"); return; } //tch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY(), ch->GetZ()); tch->WarpSet(ch->GetX(), ch->GetY(), ch->GetMapIndex()); } // LUA_ADD_GOTO_INFO struct GotoInfo { std::string st_name; BYTE empire; int mapIndex; DWORD x, y; GotoInfo() { st_name = ""; empire = 0; mapIndex = 0; x = 0; y = 0; } GotoInfo(const GotoInfo& c_src) { __copy__(c_src); } void operator = (const GotoInfo& c_src) { __copy__(c_src); } void __copy__(const GotoInfo& c_src) { st_name = c_src.st_name; empire = c_src.empire; mapIndex = c_src.mapIndex; x = c_src.x; y = c_src.y; } }; static std::vector gs_vec_gotoInfo; void CHARACTER_AddGotoInfo(const std::string& c_st_name, BYTE empire, int mapIndex, DWORD x, DWORD y) { GotoInfo newGotoInfo; newGotoInfo.st_name = c_st_name; newGotoInfo.empire = empire; newGotoInfo.mapIndex = mapIndex; newGotoInfo.x = x; newGotoInfo.y = y; gs_vec_gotoInfo.push_back(newGotoInfo); sys_log(0, "AddGotoInfo(name=%s, empire=%d, mapIndex=%d, pos=(%d, %d))", c_st_name.c_str(), empire, mapIndex, x, y); } bool FindInString(const char * c_pszFind, const char * c_pszIn) { const char * c = c_pszIn; const char * p; p = strchr(c, '|'); if (!p) return (0 == strncasecmp(c_pszFind, c_pszIn, strlen(c_pszFind))); else { char sz[64 + 1]; do { strlcpy(sz, c, MIN(sizeof(sz), (p - c) + 1)); if (!strncasecmp(c_pszFind, sz, strlen(c_pszFind))) return true; c = p + 1; } while ((p = strchr(c, '|'))); strlcpy(sz, c, sizeof(sz)); if (!strncasecmp(c_pszFind, sz, strlen(c_pszFind))) return true; } return false; } bool CHARACTER_GoToName(LPCHARACTER ch, BYTE empire, int mapIndex, const char* gotoName) { std::vector::iterator i; for (i = gs_vec_gotoInfo.begin(); i != gs_vec_gotoInfo.end(); ++i) { const GotoInfo& c_eachGotoInfo = *i; if (mapIndex != 0) { if (mapIndex != c_eachGotoInfo.mapIndex) continue; } else if (!FindInString(gotoName, c_eachGotoInfo.st_name.c_str())) continue; if (c_eachGotoInfo.empire == 0 || c_eachGotoInfo.empire == empire) { int x = c_eachGotoInfo.x * 100; int y = c_eachGotoInfo.y * 100; ch->ChatPacket(CHAT_TYPE_INFO, "You warp to ( %d, %d )", x, y); ch->WarpSet(x, y); ch->Stop(); return true; } } return false; } // END_OF_LUA_ADD_GOTO_INFO /* = { { "A1|¿µ¾ÈÀ¾¼º", 0, 1, 4693, 9642 }, { "A3|ÀÚ¾çÇö", 0, 3, 3608, 8776 }, { "B1|Á¶¾ÈÀ¾¼º", 0, 21, 557, 1579 }, { "B3|º¹Á¤Çö", 0, 23, 1385, 2349 }, { "C1|Æò¹«À¾¼º", 0, 41, 9696, 2784 }, { "C3|¹Ú¶óÇö", 0, 43, 8731, 2426 }, // Snow { "Snow|¼­ÇÑ»ê", 1, 61, 4342, 2906 }, { "Snow|¼­ÇÑ»ê", 2, 61, 3752, 1749 }, { "Snow|¼­ÇÑ»ê", 3, 61, 4918, 1736 }, // Flame { "Flame|µµ¿°È­Áö|È­¿°", 1, 62, 5994, 7563 }, { "Flame|µµ¿°È­Áö|È­¿°", 2, 62, 5978, 6222 }, { "Flame|µµ¿°È­Áö|È­¿°", 3, 62, 7307, 6898 }, // Desert { "Desert|¿µºñ»ç¸·|»ç¸·", 1, 63, 2178, 6272 }, { "Desert|¿µºñ»ç¸·|»ç¸·", 2, 63, 2219, 5027 }, { "Desert|¿µºñ»ç¸·|»ç¸·", 3, 63, 3440, 5025 }, // Threeway { "Three|½Â·æ°î", 1, 64, 4021, 6739 }, { "Three|½Â·æ°î", 2, 64, 2704, 7399 }, { "Three|½Â·æ°î", 3, 64, 3213, 8080 }, // ¹Ğ±³»ç¿ø { "Milgyo|¹Ğ±³»ç¿ø", 1, 65, 5536, 1436 }, { "Milgyo|¹Ğ±³»ç¿ø", 2, 65, 5536, 1436 }, { "Milgyo|¹Ğ±³»ç¿ø", 3, 65, 5536, 1436 }, // »ç±ÍŸ¿öÀÔ±¸ { "»ç±ÍŸ¿öÀÔ±¸", 1, 65, 5905, 1108 }, { "»ç±ÍŸ¿öÀÔ±¸", 2, 65, 5905, 1108 }, { "»ç±ÍŸ¿öÀÔ±¸", 3, 65, 5905, 1108 }, { NULL, 0, 0, 0, 0 }, }; */ ACMD(do_goto) { char arg1[256], arg2[256]; int x = 0, y = 0, z = 0; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1 && !*arg2) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: goto "); return; } if (isnhdigit(*arg1) && isnhdigit(*arg2)) { str_to_number(x, arg1); str_to_number(y, arg2); PIXEL_POSITION p; if (SECTREE_MANAGER::instance().GetMapBasePosition(ch->GetX(), ch->GetY(), p)) { x += p.x / 100; y += p.y / 100; } ch->ChatPacket(CHAT_TYPE_INFO, "You goto ( %d, %d )", x, y); } else { int mapIndex = 0; BYTE empire = 0; if (*arg1 == '#') str_to_number(mapIndex, (arg1 + 1)); if (*arg2 && isnhdigit(*arg2)) { str_to_number(empire, arg2); empire = MINMAX(1, empire, 3); } else empire = ch->GetEmpire(); if (CHARACTER_GoToName(ch, empire, mapIndex, arg1)) { ch->ChatPacket(CHAT_TYPE_INFO, "Cannot find map command syntax: /goto [empire]"); return; } return; /* int iMapIndex = 0; for (int i = 0; aWarpInfo[i].c_pszName != NULL; ++i) { if (iMapIndex != 0) { if (iMapIndex != aWarpInfo[i].iMapIndex) continue; } else if (!FindInString(arg1, aWarpInfo[i].c_pszName)) continue; if (aWarpInfo[i].bEmpire == 0 || aWarpInfo[i].bEmpire == bEmpire) { x = aWarpInfo[i].x * 100; y = aWarpInfo[i].y * 100; ch->ChatPacket(CHAT_TYPE_INFO, "You warp to ( %d, %d )", x, y); ch->WarpSet(x, y); ch->Stop(); return; } } */ } x *= 100; y *= 100; ch->Show(ch->GetMapIndex(), x, y, z); ch->Stop(); } ACMD(do_warp) { char arg1[256], arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: warp | "); return; } int x = 0, y = 0; if (isnhdigit(*arg1) && isnhdigit(*arg2)) { str_to_number(x, arg1); str_to_number(y, arg2); } else { LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1); if (NULL == tch) { const CCI* pkCCI = P2P_MANAGER::instance().Find(arg1); if (NULL != pkCCI) { if (pkCCI->bChannel != g_bChannel) { ch->ChatPacket(CHAT_TYPE_INFO, "Target is in %d channel (my channel %d)", pkCCI->bChannel, g_bChannel); return; } ch->WarpToPID( pkCCI->dwPID ); } else { ch->ChatPacket(CHAT_TYPE_INFO, "There is no one by that name"); } return; } else { x = tch->GetX() / 100; y = tch->GetY() / 100; } } x *= 100; y *= 100; ch->ChatPacket(CHAT_TYPE_INFO, "You warp to ( %d, %d )", x, y); ch->WarpSet(x, y); ch->Stop(); } ACMD(do_item) { char arg1[256], arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: item "); return; } int iCount = 1; if (*arg2) { str_to_number(iCount, arg2); iCount = MINMAX(1, iCount, ITEM_MAX_COUNT); } DWORD dwVnum; if (isnhdigit(*arg1)) str_to_number(dwVnum, arg1); else { if (!ITEM_MANAGER::instance().GetVnum(arg1, dwVnum)) { ch->ChatPacket(CHAT_TYPE_INFO, "#%u item not exist by that vnum.", dwVnum); return; } } LPITEM item = ITEM_MANAGER::instance().CreateItem(dwVnum, iCount, 0, true); if (item) { if (item->IsDragonSoul()) { int iEmptyPos = ch->GetEmptyDragonSoulInventory(item); if (iEmptyPos != -1) { item->AddToCharacter(ch, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyPos)); LogManager::instance().ItemLog(ch, item, "GM", item->GetName()); } else { M2_DESTROY_ITEM(item); if (!ch->DragonSoul_IsQualified()) { ch->ChatPacket(CHAT_TYPE_INFO, "Àκ¥ÀÌ È°¼ºÈ­ µÇÁö ¾ÊÀ½."); } else ch->ChatPacket(CHAT_TYPE_INFO, "Not enough inventory space."); } } else { int iEmptyPos = ch->GetEmptyInventory(item->GetSize()); if (iEmptyPos != -1) { item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); LogManager::instance().ItemLog(ch, item, "GM", item->GetName()); } else { M2_DESTROY_ITEM(item); ch->ChatPacket(CHAT_TYPE_INFO, "Not enough inventory space."); } } } else { ch->ChatPacket(CHAT_TYPE_INFO, "#%u item not exist by that vnum.", dwVnum); } } #ifdef WJ_SPLIT_INVENTORY_SYSTEM else if (item->IsSkillBook()) { int iEmptyPos = ch->GetEmptySkillBookInventory(item->GetSize()); if (iEmptyPos != -1) { item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); LogManager::instance().ItemLog(ch, item, "GM", item->GetName()); } else { M2_DESTROY_ITEM(item); ch->ChatPacket(CHAT_TYPE_INFO, "Not enough inventory space."); } } else if (item->IsUpgradeItem()) { int iEmptyPos = ch->GetEmptyUpgradeItemsInventory(item->GetSize()); if (iEmptyPos != -1) { item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); LogManager::instance().ItemLog(ch, item, "GM", item->GetName()); } else { M2_DESTROY_ITEM(item); ch->ChatPacket(CHAT_TYPE_INFO, "Not enough inventory space."); } } else if (item->IsStone()) { int iEmptyPos = ch->GetEmptyStoneInventory(item->GetSize()); if (iEmptyPos != -1) { item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); LogManager::instance().ItemLog(ch, item, "GM", item->GetName()); } else { M2_DESTROY_ITEM(item); ch->ChatPacket(CHAT_TYPE_INFO, "Not enough inventory space."); } } else if (item->IsSandik()) { int iEmptyPos = ch->GetEmptySandikInventory(item->GetSize()); if (iEmptyPos != -1) { item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); LogManager::instance().ItemLog(ch, item, "GM", item->GetName()); } else { M2_DESTROY_ITEM(item); ch->ChatPacket(CHAT_TYPE_INFO, "Not enough inventory space."); } } #endif else { int iEmptyPos = ch->GetEmptyInventory(item->GetSize()); if (iEmptyPos != -1) { item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); LogManager::instance().ItemLog(ch, item, "GM", item->GetName()); } else { M2_DESTROY_ITEM(item); ch->ChatPacket(CHAT_TYPE_INFO, "Envanterde bo? alan yok l?fen bo?alt??."); } } } else { ch->ChatPacket(CHAT_TYPE_INFO, "#%u item not exist by that vnum.", dwVnum); } } ACMD(do_group_random) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: grrandom "); return; } DWORD dwVnum = 0; str_to_number(dwVnum, arg1); CHARACTER_MANAGER::instance().SpawnGroupGroup(dwVnum, ch->GetMapIndex(), ch->GetX() - 500, ch->GetY() - 500, ch->GetX() + 500, ch->GetY() + 500); } ACMD(do_group) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: group "); return; } DWORD dwVnum = 0; str_to_number(dwVnum, arg1); if (test_server) sys_log(0, "COMMAND GROUP SPAWN %u at %u %u %u", dwVnum, ch->GetMapIndex(), ch->GetX(), ch->GetY()); CHARACTER_MANAGER::instance().SpawnGroup(dwVnum, ch->GetMapIndex(), ch->GetX() - 500, ch->GetY() - 500, ch->GetX() + 500, ch->GetY() + 500); } ACMD(do_mob_coward) { char arg1[256], arg2[256]; DWORD vnum = 0; LPCHARACTER tch; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: mc "); return; } const CMob * pkMob; if (isdigit(*arg1)) { str_to_number(vnum, arg1); if ((pkMob = CMobManager::instance().Get(vnum)) == NULL) vnum = 0; } else { pkMob = CMobManager::Instance().Get(arg1, true); if (pkMob) vnum = pkMob->m_table.dwVnum; } if (vnum == 0) { ch->ChatPacket(CHAT_TYPE_INFO, "No such mob by that vnum"); return; } int iCount = 0; if (*arg2) str_to_number(iCount, arg2); else iCount = 1; iCount = MIN(20, iCount); while (iCount--) { tch = CHARACTER_MANAGER::instance().SpawnMobRange(vnum, ch->GetMapIndex(), ch->GetX() - number(200, 750), ch->GetY() - number(200, 750), ch->GetX() + number(200, 750), ch->GetY() + number(200, 750), true, pkMob->m_table.bType == CHAR_TYPE_STONE); if (tch) tch->SetCoward(); } } ACMD(do_mob_map) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: mm "); return; } DWORD vnum = 0; str_to_number(vnum, arg1); LPCHARACTER tch = CHARACTER_MANAGER::instance().SpawnMobRandomPosition(vnum, ch->GetMapIndex()); if (tch) ch->ChatPacket(CHAT_TYPE_INFO, "%s spawned in %dx%d", tch->GetName(), tch->GetX(), tch->GetY()); else ch->ChatPacket(CHAT_TYPE_INFO, "Spawn failed."); } ACMD(do_mob_aggresive) { char arg1[256], arg2[256]; DWORD vnum = 0; LPCHARACTER tch; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: mob "); return; } const CMob * pkMob; if (isdigit(*arg1)) { str_to_number(vnum, arg1); if ((pkMob = CMobManager::instance().Get(vnum)) == NULL) vnum = 0; } else { pkMob = CMobManager::Instance().Get(arg1, true); if (pkMob) vnum = pkMob->m_table.dwVnum; } if (vnum == 0) { ch->ChatPacket(CHAT_TYPE_INFO, "No such mob by that vnum"); return; } int iCount = 0; if (*arg2) str_to_number(iCount, arg2); else iCount = 1; iCount = MIN(20, iCount); while (iCount--) { tch = CHARACTER_MANAGER::instance().SpawnMobRange(vnum, ch->GetMapIndex(), ch->GetX() - number(200, 750), ch->GetY() - number(200, 750), ch->GetX() + number(200, 750), ch->GetY() + number(200, 750), true, pkMob->m_table.bType == CHAR_TYPE_STONE); if (tch) tch->SetAggressive(); } } ACMD(do_mob) { char arg1[256], arg2[256]; DWORD vnum = 0; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: mob "); return; } const CMob* pkMob = NULL; if (isnhdigit(*arg1)) { str_to_number(vnum, arg1); if ((pkMob = CMobManager::instance().Get(vnum)) == NULL) vnum = 0; } else { pkMob = CMobManager::Instance().Get(arg1, true); if (pkMob) vnum = pkMob->m_table.dwVnum; } if (vnum == 0) { ch->ChatPacket(CHAT_TYPE_INFO, "No such mob by that vnum"); return; } int iCount = 0; if (*arg2) str_to_number(iCount, arg2); else iCount = 1; if (test_server) iCount = MIN(40, iCount); else iCount = MIN(20, iCount); while (iCount--) { CHARACTER_MANAGER::instance().SpawnMobRange(vnum, ch->GetMapIndex(), ch->GetX() - number(200, 750), ch->GetY() - number(200, 750), ch->GetX() + number(200, 750), ch->GetY() + number(200, 750), true, pkMob->m_table.bType == CHAR_TYPE_STONE); } } ACMD(do_mob_ld) { char arg1[256], arg2[256], arg3[256], arg4[256]; DWORD vnum = 0; two_arguments(two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3), arg4, sizeof(arg4)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: mob "); return; } const CMob* pkMob = NULL; if (isnhdigit(*arg1)) { str_to_number(vnum, arg1); if ((pkMob = CMobManager::instance().Get(vnum)) == NULL) vnum = 0; } else { pkMob = CMobManager::Instance().Get(arg1, true); if (pkMob) vnum = pkMob->m_table.dwVnum; } if (vnum == 0) { ch->ChatPacket(CHAT_TYPE_INFO, "No such mob by that vnum"); return; } int dir = 1; long x, y; if (*arg2) str_to_number(x, arg2); if (*arg3) str_to_number(y, arg3); if (*arg4) str_to_number(dir, arg4); CHARACTER_MANAGER::instance().SpawnMob(vnum, ch->GetMapIndex(), x*100, y*100, ch->GetZ(), pkMob->m_table.bType == CHAR_TYPE_STONE, dir); } struct FuncPurge { LPCHARACTER m_pkGM; bool m_bAll; FuncPurge(LPCHARACTER ch) : m_pkGM(ch), m_bAll(false) { } void operator () (LPENTITY ent) { if (!ent->IsType(ENTITY_CHARACTER)) return; LPCHARACTER pkChr = (LPCHARACTER) ent; int iDist = DISTANCE_APPROX(pkChr->GetX() - m_pkGM->GetX(), pkChr->GetY() - m_pkGM->GetY()); if (!m_bAll && iDist >= 1000) // 10¹ÌÅÍ ÀÌ»ó¿¡ ÀÖ´Â °ÍµéÀº purge ÇÏÁö ¾Ê´Â´Ù. return; sys_log(0, "PURGE: %s %d", pkChr->GetName(), iDist); if (pkChr->IsNPC() && !pkChr->IsPet() && pkChr->GetRider() == NULL) { M2_DESTROY_CHARACTER(pkChr); } } }; ACMD(do_purge) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); FuncPurge func(ch); if (*arg1 && !strcmp(arg1, "all")) func.m_bAll = true; LPSECTREE sectree = ch->GetSectree(); if (sectree) // #431 sectree->ForEachAround(func); else sys_err("PURGE_ERROR.NULL_SECTREE(mapIndex=%d, pos=(%d, %d)", ch->GetMapIndex(), ch->GetX(), ch->GetY()); } ACMD(do_item_purge) { int i; LPITEM item; for (i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i) { if ((item = ch->GetInventoryItem(i))) { if (item->IsEquipped()) continue; ITEM_MANAGER::instance().RemoveItem(item, "PURGE"); ch->SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 255); } } for (i = 0; i < DRAGON_SOUL_INVENTORY_MAX_NUM; ++i) { if ((item = ch->GetItem(TItemPos(DRAGON_SOUL_INVENTORY, i )))) { if (item->IsEquipped()) continue; ITEM_MANAGER::instance().RemoveItem(item, "PURGE"); } } } ACMD(do_state) { char arg1[256]; LPCHARACTER tch; one_argument(argument, arg1, sizeof(arg1)); if (*arg1) { if (arg1[0] == '#') { tch = CHARACTER_MANAGER::instance().Find(strtoul(arg1+1, NULL, 10)); } else { LPDESC d = DESC_MANAGER::instance().FindByCharacterName(arg1); if (!d) tch = NULL; else tch = d->GetCharacter(); } } else tch = ch; if (!tch) return; char buf[256]; snprintf(buf, sizeof(buf), "%s's State: ", tch->GetName()); if (tch->IsPosition(POS_FIGHTING)) strlcat(buf, "Battle", sizeof(buf)); else if (tch->IsPosition(POS_DEAD)) strlcat(buf, "Dead", sizeof(buf)); else strlcat(buf, "Standing", sizeof(buf)); if (ch->GetShop()) strlcat(buf, ", Shop", sizeof(buf)); if (ch->GetExchange()) strlcat(buf, ", Exchange", sizeof(buf)); ch->ChatPacket(CHAT_TYPE_INFO, "%s", buf); int len; len = snprintf(buf, sizeof(buf), "Coordinate %ldx%ld (%ldx%ld)", tch->GetX(), tch->GetY(), tch->GetX() / 100, tch->GetY() / 100); if (len < 0 || len >= (int) sizeof(buf)) len = sizeof(buf) - 1; LPSECTREE pSec = SECTREE_MANAGER::instance().Get(tch->GetMapIndex(), tch->GetX(), tch->GetY()); if (pSec) { TMapSetting& map_setting = SECTREE_MANAGER::instance().GetMap(tch->GetMapIndex())->m_setting; snprintf(buf + len, sizeof(buf) - len, " MapIndex %ld Attribute %08X Local Position (%ld x %ld)", tch->GetMapIndex(), pSec->GetAttribute(tch->GetX(), tch->GetY()), (tch->GetX() - map_setting.iBaseX)/100, (tch->GetY() - map_setting.iBaseY)/100); } ch->ChatPacket(CHAT_TYPE_INFO, "%s", buf); ch->ChatPacket(CHAT_TYPE_INFO, "LEV %d", tch->GetLevel()); ch->ChatPacket(CHAT_TYPE_INFO, "HP %d/%d", tch->GetHP(), tch->GetMaxHP()); ch->ChatPacket(CHAT_TYPE_INFO, "SP %d/%d", tch->GetSP(), tch->GetMaxSP()); ch->ChatPacket(CHAT_TYPE_INFO, "ATT %d MAGIC_ATT %d SPD %d CRIT %d%% PENE %d%% ATT_BONUS %d%%", tch->GetPoint(POINT_ATT_GRADE), tch->GetPoint(POINT_MAGIC_ATT_GRADE), tch->GetPoint(POINT_ATT_SPEED), tch->GetPoint(POINT_CRITICAL_PCT), tch->GetPoint(POINT_PENETRATE_PCT), tch->GetPoint(POINT_ATT_BONUS)); ch->ChatPacket(CHAT_TYPE_INFO, "DEF %d MAGIC_DEF %d BLOCK %d%% DODGE %d%% DEF_BONUS %d%%", tch->GetPoint(POINT_DEF_GRADE), tch->GetPoint(POINT_MAGIC_DEF_GRADE), tch->GetPoint(POINT_BLOCK), tch->GetPoint(POINT_DODGE), tch->GetPoint(POINT_DEF_BONUS)); ch->ChatPacket(CHAT_TYPE_INFO, "RESISTANCES:"); ch->ChatPacket(CHAT_TYPE_INFO, " WARR:%3d%% ASAS:%3d%% SURA:%3d%% SHAM:%3d%%", tch->GetPoint(POINT_RESIST_WARRIOR), tch->GetPoint(POINT_RESIST_ASSASSIN), tch->GetPoint(POINT_RESIST_SURA), tch->GetPoint(POINT_RESIST_SHAMAN)); ch->ChatPacket(CHAT_TYPE_INFO, " SWORD:%3d%% THSWORD:%3d%% DAGGER:%3d%% BELL:%3d%% FAN:%3d%% BOW:%3d%%", tch->GetPoint(POINT_RESIST_SWORD), tch->GetPoint(POINT_RESIST_TWOHAND), tch->GetPoint(POINT_RESIST_DAGGER), tch->GetPoint(POINT_RESIST_BELL), tch->GetPoint(POINT_RESIST_FAN), tch->GetPoint(POINT_RESIST_BOW)); ch->ChatPacket(CHAT_TYPE_INFO, " FIRE:%3d%% ELEC:%3d%% MAGIC:%3d%% WIND:%3d%% CRIT:%3d%% PENE:%3d%%", tch->GetPoint(POINT_RESIST_FIRE), tch->GetPoint(POINT_RESIST_ELEC), tch->GetPoint(POINT_RESIST_MAGIC), tch->GetPoint(POINT_RESIST_WIND), tch->GetPoint(POINT_RESIST_CRITICAL), tch->GetPoint(POINT_RESIST_PENETRATE)); ch->ChatPacket(CHAT_TYPE_INFO, " ICE:%3d%% EARTH:%3d%% DARK:%3d%%", tch->GetPoint(POINT_RESIST_ICE), tch->GetPoint(POINT_RESIST_EARTH), tch->GetPoint(POINT_RESIST_DARK)); ch->ChatPacket(CHAT_TYPE_INFO, "MALL:"); ch->ChatPacket(CHAT_TYPE_INFO, " ATT:%3d%% DEF:%3d%% EXP:%3d%% ITEMx%d GOLDx%d", tch->GetPoint(POINT_MALL_ATTBONUS), tch->GetPoint(POINT_MALL_DEFBONUS), tch->GetPoint(POINT_MALL_EXPBONUS), tch->GetPoint(POINT_MALL_ITEMBONUS) / 10, tch->GetPoint(POINT_MALL_GOLDBONUS) / 10); ch->ChatPacket(CHAT_TYPE_INFO, "BONUS:"); ch->ChatPacket(CHAT_TYPE_INFO, " SKILL:%3d%% NORMAL:%3d%% SKILL_DEF:%3d%% NORMAL_DEF:%3d%%", tch->GetPoint(POINT_SKILL_DAMAGE_BONUS), tch->GetPoint(POINT_NORMAL_HIT_DAMAGE_BONUS), tch->GetPoint(POINT_SKILL_DEFEND_BONUS), tch->GetPoint(POINT_NORMAL_HIT_DEFEND_BONUS)); ch->ChatPacket(CHAT_TYPE_INFO, " HUMAN:%3d%% ANIMAL:%3d%% ORC:%3d%% MILGYO:%3d%% UNDEAD:%3d%%", tch->GetPoint(POINT_ATTBONUS_HUMAN), tch->GetPoint(POINT_ATTBONUS_ANIMAL), tch->GetPoint(POINT_ATTBONUS_ORC), tch->GetPoint(POINT_ATTBONUS_MILGYO), tch->GetPoint(POINT_ATTBONUS_UNDEAD)); ch->ChatPacket(CHAT_TYPE_INFO, " DEVIL:%3d%% INSECT:%3d%% FIRE:%3d%% ICE:%3d%% DESERT:%3d%%", tch->GetPoint(POINT_ATTBONUS_DEVIL), tch->GetPoint(POINT_ATTBONUS_INSECT), tch->GetPoint(POINT_ATTBONUS_FIRE), tch->GetPoint(POINT_ATTBONUS_ICE), tch->GetPoint(POINT_ATTBONUS_DESERT)); ch->ChatPacket(CHAT_TYPE_INFO, " TREE:%3d%% MONSTER:%3d%%", tch->GetPoint(POINT_ATTBONUS_TREE), tch->GetPoint(POINT_ATTBONUS_MONSTER)); ch->ChatPacket(CHAT_TYPE_INFO, " WARR:%3d%% ASAS:%3d%% SURA:%3d%% SHAM:%3d%%", tch->GetPoint(POINT_ATTBONUS_WARRIOR), tch->GetPoint(POINT_ATTBONUS_ASSASSIN), tch->GetPoint(POINT_ATTBONUS_SURA), tch->GetPoint(POINT_ATTBONUS_SHAMAN)); for (int i = 0; i < MAX_PRIV_NUM; ++i) if (CPrivManager::instance().GetPriv(tch, i)) { int iByEmpire = CPrivManager::instance().GetPrivByEmpire(tch->GetEmpire(), i); int iByGuild = 0; if (tch->GetGuild()) iByGuild = CPrivManager::instance().GetPrivByGuild(tch->GetGuild()->GetID(), i); int iByPlayer = CPrivManager::instance().GetPrivByCharacter(tch->GetPlayerID(), i); if (iByEmpire) ch->ChatPacket(CHAT_TYPE_INFO, "%s for empire : %d", LC_TEXT(c_apszPrivNames[i]), iByEmpire); if (iByGuild) ch->ChatPacket(CHAT_TYPE_INFO, "%s for guild : %d", LC_TEXT(c_apszPrivNames[i]), iByGuild); if (iByPlayer) ch->ChatPacket(CHAT_TYPE_INFO, "%s for player : %d", LC_TEXT(c_apszPrivNames[i]), iByPlayer); } } struct notice_packet_func { const char * m_str; notice_packet_func(const char * str) : m_str(str) { } void operator () (LPDESC d) { if (!d->GetCharacter()) return; d->GetCharacter()->ChatPacket(CHAT_TYPE_NOTICE, "%s", m_str); } }; struct monarch_notice_packet_func { const char * m_str; BYTE m_bEmpire; monarch_notice_packet_func(BYTE bEmpire, const char * str) : m_str(str), m_bEmpire(bEmpire) { } void operator () (LPDESC d) { if (!d->GetCharacter()) return; if (m_bEmpire == d->GetCharacter()->GetEmpire()) { d->GetCharacter()->ChatPacket(CHAT_TYPE_NOTICE, "%s", m_str); } } }; void SendNotice(const char * c_pszBuf) { const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet(); std::for_each(c_ref_set.begin(), c_ref_set.end(), notice_packet_func(c_pszBuf)); } void SendMonarchNotice(BYTE bEmpire, const char* c_pszBuf) { const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet(); std::for_each(c_ref_set.begin(), c_ref_set.end(), monarch_notice_packet_func(bEmpire, c_pszBuf)); } struct notice_map_packet_func { const char* m_str; int m_mapIndex; bool m_bBigFont; notice_map_packet_func(const char* str, int idx, bool bBigFont) : m_str(str), m_mapIndex(idx), m_bBigFont(bBigFont) { } void operator() (LPDESC d) { if (d->GetCharacter() == NULL) return; if (d->GetCharacter()->GetMapIndex() != m_mapIndex) return; d->GetCharacter()->ChatPacket(m_bBigFont == true ? CHAT_TYPE_BIG_NOTICE : CHAT_TYPE_NOTICE, "%s", m_str); } }; void SendNoticeMap(const char* c_pszBuf, int nMapIndex, bool bBigFont) { const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet(); std::for_each(c_ref_set.begin(), c_ref_set.end(), notice_map_packet_func(c_pszBuf, nMapIndex, bBigFont)); } struct log_packet_func { const char * m_str; log_packet_func(const char * str) : m_str(str) { } void operator () (LPDESC d) { if (!d->GetCharacter()) return; if (d->GetCharacter()->GetGMLevel() > GM_PLAYER) d->GetCharacter()->ChatPacket(CHAT_TYPE_NOTICE, "%s", m_str); } }; void SendLog(const char * c_pszBuf) { const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet(); std::for_each(c_ref_set.begin(), c_ref_set.end(), log_packet_func(c_pszBuf)); } void BroadcastNotice(const char * c_pszBuf) { TPacketGGNotice p; p.bHeader = HEADER_GG_NOTICE; p.lSize = strlen(c_pszBuf) + 1; TEMP_BUFFER buf; buf.write(&p, sizeof(p)); buf.write(c_pszBuf, p.lSize); P2P_MANAGER::instance().Send(buf.read_peek(), buf.size()); // HEADER_GG_NOTICE SendNotice(c_pszBuf); } void BroadcastMonarchNotice(BYTE bEmpire, const char * c_pszBuf) { TPacketGGMonarchNotice p; p.bHeader = HEADER_GG_MONARCH_NOTICE; p.bEmpire = bEmpire; p.lSize = strlen(c_pszBuf) + 1; TEMP_BUFFER buf; buf.write(&p, sizeof(p)); buf.write(c_pszBuf, p.lSize); P2P_MANAGER::instance().Send(buf.read_peek(), buf.size()); SendMonarchNotice(bEmpire, c_pszBuf); } ACMD(do_notice) { BroadcastNotice(argument); } ACMD(do_map_notice) { SendNoticeMap(argument, ch->GetMapIndex(), false); } ACMD(do_big_notice) { ch->ChatPacket(CHAT_TYPE_BIG_NOTICE, "%s", argument); } ACMD(do_monarch_notice) { if (ch->IsMonarch() == true) { BroadcastMonarchNotice(ch->GetEmpire(), argument); } else { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±ºÁÖ¸¸ÀÌ »ç¿ë °¡´ÉÇÑ ±â´ÉÀÔ´Ï´Ù")); } } ACMD(do_who) { int iTotal; int * paiEmpireUserCount; int iLocal; DESC_MANAGER::instance().GetUserCount(iTotal, &paiEmpireUserCount, iLocal); ch->ChatPacket(CHAT_TYPE_INFO, "Total [%d] %d / %d / %d (this server %d)", iTotal, paiEmpireUserCount[1], paiEmpireUserCount[2], paiEmpireUserCount[3], iLocal); } class user_func { public: LPCHARACTER m_ch; static int count; static char str[128]; static int str_len; user_func() : m_ch(NULL) {} void initialize(LPCHARACTER ch) { m_ch = ch; str_len = 0; count = 0; str[0] = '\0'; } void operator () (LPDESC d) { if (!d->GetCharacter()) return; int len = snprintf(str + str_len, sizeof(str) - str_len, "%-16s ", d->GetCharacter()->GetName()); if (len < 0 || len >= (int) sizeof(str) - str_len) len = (sizeof(str) - str_len) - 1; str_len += len; ++count; if (!(count % 4)) { m_ch->ChatPacket(CHAT_TYPE_INFO, str); str[0] = '\0'; str_len = 0; } } }; int user_func::count = 0; char user_func::str[128] = { 0, }; int user_func::str_len = 0; ACMD(do_user) { const DESC_MANAGER::DESC_SET & c_ref_set = DESC_MANAGER::instance().GetClientSet(); user_func func; func.initialize(ch); std::for_each(c_ref_set.begin(), c_ref_set.end(), func); if (func.count % 4) ch->ChatPacket(CHAT_TYPE_INFO, func.str); ch->ChatPacket(CHAT_TYPE_INFO, "Total %d", func.count); } ACMD(do_disconnect) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "ex) /dc "); return; } LPDESC d = DESC_MANAGER::instance().FindByCharacterName(arg1); LPCHARACTER tch = d ? d->GetCharacter() : NULL; if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "%s: no such a player.", arg1); return; } if (tch == ch) { ch->ChatPacket(CHAT_TYPE_INFO, "cannot disconnect myself"); return; } DESC_MANAGER::instance().DestroyDesc(d); } ACMD(do_kill) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "ex) /kill "); return; } LPDESC d = DESC_MANAGER::instance().FindByCharacterName(arg1); LPCHARACTER tch = d ? d->GetCharacter() : NULL; if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "%s: no such a player", arg1); return; } tch->Dead(); } #define MISC 0 #define BINARY 1 #define NUMBER 2 const struct set_struct { const char *cmd; const char type; } set_fields[] = { { "gold", NUMBER }, { "race", BINARY }, { "sex", BINARY }, { "exp", NUMBER }, { "max_hp", NUMBER }, { "max_sp", NUMBER }, { "skill", NUMBER }, { "alignment", NUMBER }, { "align", NUMBER }, #ifdef ENABLE_CHEQUE_SYSTEM { "won", NUMBER }, #endif { "\n", MISC } }; ACMD(do_set) { char arg1[256], arg2[256], arg3[256]; LPCHARACTER tch = NULL; int i, len; const char* line; line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); one_argument(line, arg3, sizeof(arg3)); if (!*arg1 || !*arg2 || !*arg3) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: set "); return; } tch = CHARACTER_MANAGER::instance().FindPC(arg1); if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "%s not exist", arg1); return; } len = strlen(arg2); for (i = 0; *(set_fields[i].cmd) != '\n'; i++) if (!strncmp(arg2, set_fields[i].cmd, len)) break; switch (i) { case 0: // gold { int gold = 0; str_to_number(gold, arg3); DBManager::instance().SendMoneyLog(MONEY_LOG_MISC, 3, gold); int before_gold = tch->GetGold(); tch->PointChange(POINT_GOLD, gold, true); int after_gold = tch->GetGold(); if (0 == after_gold && 0 != before_gold) { LogManager::instance().CharLog(tch, gold, "ZERO_GOLD", "GM"); } } break; case 1: // race break; case 2: // sex break; case 3: // exp { int amount = 0; str_to_number(amount, arg3); tch->PointChange(POINT_EXP, amount, true); } break; case 4: // max_hp { int amount = 0; str_to_number(amount, arg3); tch->PointChange(POINT_MAX_HP, amount, true); } break; case 5: // max_sp { int amount = 0; str_to_number(amount, arg3); tch->PointChange(POINT_MAX_SP, amount, true); } break; case 6: // active skill point { int amount = 0; str_to_number(amount, arg3); tch->PointChange(POINT_SKILL, amount, true); } break; case 7: // alignment case 8: // alignment { int amount = 0; str_to_number(amount, arg3); tch->UpdateAlignment(amount - ch->GetRealAlignment()); } break; #ifdef ENABLE_CHEQUE_SYSTEM case 9: // won blackdragonx61 { int won = 0; str_to_number(won, arg3); int before_won = tch->GetCheque(); if (before_won + won > 99) { ch->ChatPacket(CHAT_TYPE_INFO, "%s'nin Won toplami 99'u asiyor", tch->GetName()); return; } // tch->SetCheque(tch->GetCheque() + won); tch->PointChange(POINT_CHEQUE, won, true); } break; #endif } if (set_fields[i].type == NUMBER) { int amount = 0; str_to_number(amount, arg3); ch->ChatPacket(CHAT_TYPE_INFO, "%s's %s set to [%d]", tch->GetName(), set_fields[i].cmd, amount); } } ACMD(do_reset) { ch->PointChange(POINT_HP, ch->GetMaxHP() - ch->GetHP()); ch->PointChange(POINT_SP, ch->GetMaxSP() - ch->GetSP()); ch->Save(); } ACMD(do_advance) { char arg1[256], arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1 || !*arg2) { ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: advance "); return; } LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(arg1); if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "%s not exist", arg1); return; } int level = 0; str_to_number(level, arg2); tch->ResetPoint(MINMAX(0, level, PLAYER_MAX_LEVEL_CONST)); } ACMD(do_respawn) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (*arg1 && !strcasecmp(arg1, "all")) { ch->ChatPacket(CHAT_TYPE_INFO, "Respaw everywhere"); regen_reset(0, 0); } else { ch->ChatPacket(CHAT_TYPE_INFO, "Respaw around"); regen_reset(ch->GetX(), ch->GetY()); } } ACMD(do_safebox_size) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); int size = 0; if (*arg1) str_to_number(size, arg1); if (size > 3 || size < 0) size = 0; ch->ChatPacket(CHAT_TYPE_INFO, "Safebox size set to %d", size); ch->ChangeSafeboxSize(size); } ACMD(do_makeguild) { if (ch->GetGuild()) return; CGuildManager& gm = CGuildManager::instance(); char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); TGuildCreateParameter cp; memset(&cp, 0, sizeof(cp)); cp.master = ch; strlcpy(cp.name, arg1, sizeof(cp.name)); if (!check_name(cp.name)) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀûÇÕÇÏÁö ¾ÊÀº ±æµå À̸§ ÀÔ´Ï´Ù.")); return; } gm.CreateGuild(cp); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("(%s) ±æµå°¡ »ı¼ºµÇ¾ú½À´Ï´Ù. [ÀÓ½Ã]"), cp.name); } ACMD(do_deleteguild) { if (ch->GetGuild()) ch->GetGuild()->RequestDisband(ch->GetPlayerID()); } ACMD(do_greset) { if (ch->GetGuild()) ch->GetGuild()->Reset(); } // REFINE_ROD_HACK_BUG_FIX ACMD(do_refine_rod) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); BYTE cell = 0; str_to_number(cell, arg1); LPITEM item = ch->GetInventoryItem(cell); if (item) fishing::RealRefineRod(ch, item); } // END_OF_REFINE_ROD_HACK_BUG_FIX // REFINE_PICK ACMD(do_refine_pick) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); BYTE cell = 0; str_to_number(cell, arg1); LPITEM item = ch->GetInventoryItem(cell); if (item) { mining::CHEAT_MAX_PICK(ch, item); mining::RealRefinePick(ch, item); } } ACMD(do_max_pick) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); BYTE cell = 0; str_to_number(cell, arg1); LPITEM item = ch->GetInventoryItem(cell); if (item) { mining::CHEAT_MAX_PICK(ch, item); } } // END_OF_REFINE_PICK ACMD(do_fishing_simul) { char arg1[256]; char arg2[256]; char arg3[256]; argument = one_argument(argument, arg1, sizeof(arg1)); two_arguments(argument, arg2, sizeof(arg2), arg3, sizeof(arg3)); int count = 1000; int prob_idx = 0; int level = 100; ch->ChatPacket(CHAT_TYPE_INFO, "Usage: fishing_simul "); if (*arg1) str_to_number(level, arg1); if (*arg2) str_to_number(prob_idx, arg2); if (*arg3) str_to_number(count, arg3); fishing::Simulation(level, count, prob_idx, ch); } ACMD(do_invisibility) { if (ch->IsAffectFlag(AFF_INVISIBILITY)) { ch->RemoveAffect(AFFECT_INVISIBILITY); } else { ch->AddAffect(AFFECT_INVISIBILITY, POINT_NONE, 0, AFF_INVISIBILITY, INFINITE_AFFECT_DURATION, 0, true); } } ACMD(do_event_flag) { char arg1[256]; char arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!(*arg1) || !(*arg2)) return; int value = 0; str_to_number(value, arg2); if (!strcmp(arg1, "mob_item") || !strcmp(arg1, "mob_exp") || !strcmp(arg1, "mob_gold") || !strcmp(arg1, "mob_dam") || !strcmp(arg1, "mob_gold_pct") || !strcmp(arg1, "mob_item_buyer") || !strcmp(arg1, "mob_exp_buyer") || !strcmp(arg1, "mob_gold_buyer") || !strcmp(arg1, "mob_gold_pct_buyer") ) value = MINMAX(0, value, 1000); //quest::CQuestManager::instance().SetEventFlag(arg1, atoi(arg2)); quest::CQuestManager::instance().RequestSetEventFlag(arg1, value); ch->ChatPacket(CHAT_TYPE_INFO, "RequestSetEventFlag %s %d", arg1, value); sys_log(0, "RequestSetEventFlag %s %d", arg1, value); } ACMD(do_get_event_flag) { quest::CQuestManager::instance().SendEventFlagList(ch); } ACMD(do_private) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: private "); return; } long lMapIndex; long map_index = 0; str_to_number(map_index, arg1); if ((lMapIndex = SECTREE_MANAGER::instance().CreatePrivateMap(map_index))) { ch->SaveExitLocation(); LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(lMapIndex); ch->WarpSet(pkSectreeMap->m_setting.posSpawn.x, pkSectreeMap->m_setting.posSpawn.y, lMapIndex); } else ch->ChatPacket(CHAT_TYPE_INFO, "Can't find map by index %d", map_index); } ACMD(do_qf) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) return; quest::PC* pPC = quest::CQuestManager::instance().GetPCForce(ch->GetPlayerID()); std::string questname = pPC->GetCurrentQuestName(); if (!questname.empty()) { int value = quest::CQuestManager::Instance().GetQuestStateIndex(questname, arg1); pPC->SetFlag(questname + ".__status", value); pPC->ClearTimer(); quest::PC::QuestInfoIterator it = pPC->quest_begin(); unsigned int questindex = quest::CQuestManager::instance().GetQuestIndexByName(questname); while (it!= pPC->quest_end()) { if (it->first == questindex) { it->second.st = value; break; } ++it; } ch->ChatPacket(CHAT_TYPE_INFO, "setting quest state flag %s %s %d", questname.c_str(), arg1, value); } else { ch->ChatPacket(CHAT_TYPE_INFO, "setting quest state flag failed"); } } LPCHARACTER chHori, chForge, chLib, chTemple, chTraining, chTree, chPortal, chBall; ACMD(do_b1) { //È£¸®º´ 478 579 chHori = CHARACTER_MANAGER::instance().SpawnMobRange(14017, ch->GetMapIndex(), 304222, 742858, 304222, 742858, true, false); chHori->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_BUILDING_CONSTRUCTION_SMALL, 65535, 0, true); chHori->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true); for (int i = 0; i < 30; ++i) { int rot = number(0, 359); float fx, fy; GetDeltaByDegree(rot, 800, &fx, &fy); LPCHARACTER tch = CHARACTER_MANAGER::instance().SpawnMobRange(number(701, 706), ch->GetMapIndex(), 304222 + (int)fx, 742858 + (int)fy, 304222 + (int)fx, 742858 + (int)fy, true, false); tch->SetAggressive(); } for (int i = 0; i < 5; ++i) { int rot = number(0, 359); float fx, fy; GetDeltaByDegree(rot, 800, &fx, &fy); LPCHARACTER tch = CHARACTER_MANAGER::instance().SpawnMobRange(8009, ch->GetMapIndex(), 304222 + (int)fx, 742858 + (int)fy, 304222 + (int)fx, 742858 + (int)fy, true, false); tch->SetAggressive(); } } ACMD(do_b2) { chHori->RemoveAffect(AFFECT_DUNGEON_UNIQUE); } ACMD(do_b3) { // Æ÷Áö 492 547 chForge = CHARACTER_MANAGER::instance().SpawnMobRange(14003, ch->GetMapIndex(), 307500, 746300, 307500, 746300, true, false); chForge->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true); //³ôÀºÅ¾ 509 589 -> µµ¼­°ü chLib = CHARACTER_MANAGER::instance().SpawnMobRange(14007, ch->GetMapIndex(), 307900, 744500, 307900, 744500, true, false); chLib->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true); //¿åÁ¶ 513 606 -> ÈûÀǽÅÀü chTemple = CHARACTER_MANAGER::instance().SpawnMobRange(14004, ch->GetMapIndex(), 307700, 741600, 307700, 741600, true, false); chTemple->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true); //±ÇÅõÀå 490 625 chTraining= CHARACTER_MANAGER::instance().SpawnMobRange(14010, ch->GetMapIndex(), 307100, 739500, 307100, 739500, true, false); chTraining->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true); //³ª¹« 466 614 chTree= CHARACTER_MANAGER::instance().SpawnMobRange(14013, ch->GetMapIndex(), 300800, 741600, 300800, 741600, true, false); chTree->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true); //Æ÷Å» 439 615 chPortal= CHARACTER_MANAGER::instance().SpawnMobRange(14001, ch->GetMapIndex(), 300900, 744500, 300900, 744500, true, false); chPortal->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true); // ±¸½½ 436 600 chBall = CHARACTER_MANAGER::instance().SpawnMobRange(14012, ch->GetMapIndex(), 302500, 746600, 302500, 746600, true, false); chBall->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true); } ACMD(do_b4) { chLib->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_BUILDING_UPGRADE, 65535, 0, true); for (int i = 0; i < 30; ++i) { int rot = number(0, 359); float fx, fy; GetDeltaByDegree(rot, 1200, &fx, &fy); LPCHARACTER tch = CHARACTER_MANAGER::instance().SpawnMobRange(number(701, 706), ch->GetMapIndex(), 307900 + (int)fx, 744500 + (int)fy, 307900 + (int)fx, 744500 + (int)fy, true, false); tch->SetAggressive(); } for (int i = 0; i < 5; ++i) { int rot = number(0, 359); float fx, fy; GetDeltaByDegree(rot, 1200, &fx, &fy); LPCHARACTER tch = CHARACTER_MANAGER::instance().SpawnMobRange(8009, ch->GetMapIndex(), 307900 + (int)fx, 744500 + (int)fy, 307900 + (int)fx, 744500 + (int)fy, true, false); tch->SetAggressive(); } } ACMD(do_b5) { M2_DESTROY_CHARACTER(chLib); //chHori->RemoveAffect(AFFECT_DUNGEON_UNIQUE); chLib = CHARACTER_MANAGER::instance().SpawnMobRange(14008, ch->GetMapIndex(), 307900, 744500, 307900, 744500, true, false); chLib->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true); } ACMD(do_b6) { chLib->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_BUILDING_UPGRADE, 65535, 0, true); } ACMD(do_b7) { M2_DESTROY_CHARACTER(chLib); //chHori->RemoveAffect(AFFECT_DUNGEON_UNIQUE); chLib = CHARACTER_MANAGER::instance().SpawnMobRange(14009, ch->GetMapIndex(), 307900, 744500, 307900, 744500, true, false); chLib->AddAffect(AFFECT_DUNGEON_UNIQUE, POINT_NONE, 0, AFF_DUNGEON_UNIQUE, 65535, 0, true); } ACMD(do_book) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); CSkillProto * pkProto; if (isnhdigit(*arg1)) { DWORD vnum = 0; str_to_number(vnum, arg1); pkProto = CSkillManager::instance().Get(vnum); } else pkProto = CSkillManager::instance().Get(arg1); if (!pkProto) { ch->ChatPacket(CHAT_TYPE_INFO, "There is no such a skill."); return; } LPITEM item = ch->AutoGiveItem(50300); item->SetSocket(0, pkProto->dwVnum); } ACMD(do_setskillother) { char arg1[256], arg2[256], arg3[256]; argument = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); one_argument(argument, arg3, sizeof(arg3)); if (!*arg1 || !*arg2 || !*arg3 || !isdigit(*arg3)) { ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: setskillother "); return; } LPCHARACTER tch; tch = CHARACTER_MANAGER::instance().FindPC(arg1); if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "There is no such character."); return; } CSkillProto * pk; if (isdigit(*arg2)) { DWORD vnum = 0; str_to_number(vnum, arg2); pk = CSkillManager::instance().Get(vnum); } else pk = CSkillManager::instance().Get(arg2); if (!pk) { ch->ChatPacket(CHAT_TYPE_INFO, "No such a skill by that name."); return; } BYTE level = 0; str_to_number(level, arg3); tch->SetSkillLevel(pk->dwVnum, level); tch->ComputePoints(); tch->SkillLevelPacket(); } ACMD(do_setskill) { char arg1[256], arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1 || !*arg2 || !isdigit(*arg2)) { ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: setskill "); return; } CSkillProto * pk; if (isdigit(*arg1)) { DWORD vnum = 0; str_to_number(vnum, arg1); pk = CSkillManager::instance().Get(vnum); } else pk = CSkillManager::instance().Get(arg1); if (!pk) { ch->ChatPacket(CHAT_TYPE_INFO, "No such a skill by that name."); return; } BYTE level = 0; str_to_number(level, arg2); ch->SetSkillLevel(pk->dwVnum, level); ch->ComputePoints(); ch->SkillLevelPacket(); } ACMD(do_set_skill_point) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); int skill_point = 0; if (*arg1) str_to_number(skill_point, arg1); ch->SetRealPoint(POINT_SKILL, skill_point); ch->SetPoint(POINT_SKILL, ch->GetRealPoint(POINT_SKILL)); ch->PointChange(POINT_SKILL, 0); } ACMD(do_set_skill_group) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); int skill_group = 0; if (*arg1) str_to_number(skill_group, arg1); ch->SetSkillGroup(skill_group); ch->ClearSkill(); ch->ChatPacket(CHAT_TYPE_INFO, "skill group to %d.", skill_group); } ACMD(do_reload) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (*arg1) { switch (LOWER(*arg1)) { case 'u': ch->ChatPacket(CHAT_TYPE_INFO, "Reloading state_user_count."); LoadStateUserCount(); break; case 'p': ch->ChatPacket(CHAT_TYPE_INFO, "Reloading prototype tables,"); db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0); break; case 's': ch->ChatPacket(CHAT_TYPE_INFO, "Reloading notice string."); DBManager::instance().LoadDBString(); break; case 'q': ch->ChatPacket(CHAT_TYPE_INFO, "Reloading quest."); quest::CQuestManager::instance().Reload(); break; case 'f': fishing::Initialize(); break; //RELOAD_ADMIN case 'a': ch->ChatPacket(CHAT_TYPE_INFO, "Reloading Admin infomation."); db_clientdesc->DBPacket(HEADER_GD_RELOAD_ADMIN, 0, NULL, 0); sys_log(0, "Reloading admin infomation."); break; //END_RELOAD_ADMIN case 'c': // cube // ·ÎÄà ÇÁ·Î¼¼½º¸¸ °»»êÇÑ´Ù. Cube_init (); break; } } else { ch->ChatPacket(CHAT_TYPE_INFO, "Reloading state_user_count."); LoadStateUserCount(); ch->ChatPacket(CHAT_TYPE_INFO, "Reloading prototype tables,"); db_clientdesc->DBPacket(HEADER_GD_RELOAD_PROTO, 0, NULL, 0); ch->ChatPacket(CHAT_TYPE_INFO, "Reloading notice string."); DBManager::instance().LoadDBString(); } } ACMD(do_cooltime) { ch->DisableCooltime(); } ACMD(do_level) { char arg2[256]; one_argument(argument, arg2, sizeof(arg2)); if (!*arg2) { ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: level "); return; } int level = 0; str_to_number(level, arg2); ch->ResetPoint(MINMAX(1, level, PLAYER_MAX_LEVEL_CONST)); } ACMD(do_gwlist) { ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("ÇöÀç ÀüÀïÁßÀÎ ±æµå ÀÔ´Ï´Ù")); CGuildManager::instance().ShowGuildWarList(ch); } ACMD(do_stop_guild_war) { char arg1[256], arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1 || !*arg2) return; int id1 = 0, id2 = 0; str_to_number(id1, arg1); str_to_number(id2, arg2); if (!id1 || !id2) return; if (id1 > id2) { std::swap(id1, id2); } ch->ChatPacket(CHAT_TYPE_TALKING, "%d %d", id1, id2); CGuildManager::instance().RequestEndWar(id1, id2); } ACMD(do_cancel_guild_war) { char arg1[256], arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); int id1 = 0, id2 = 0; str_to_number(id1, arg1); str_to_number(id2, arg2); if (id1 > id2) std::swap(id1, id2); CGuildManager::instance().RequestCancelWar(id1, id2); } ACMD(do_guild_state) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); CGuild* pGuild = CGuildManager::instance().FindGuildByName(arg1); if (pGuild != NULL) { ch->ChatPacket(CHAT_TYPE_INFO, "GuildID: %d", pGuild->GetID()); ch->ChatPacket(CHAT_TYPE_INFO, "GuildMasterPID: %d", pGuild->GetMasterPID()); ch->ChatPacket(CHAT_TYPE_INFO, "IsInWar: %d", pGuild->UnderAnyWar()); } else { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s: Á¸ÀçÇÏÁö ¾Ê´Â ±æµå ÀÔ´Ï´Ù."), arg1); } } struct FuncWeaken { LPCHARACTER m_pkGM; bool m_bAll; FuncWeaken(LPCHARACTER ch) : m_pkGM(ch), m_bAll(false) { } void operator () (LPENTITY ent) { if (!ent->IsType(ENTITY_CHARACTER)) return; LPCHARACTER pkChr = (LPCHARACTER) ent; int iDist = DISTANCE_APPROX(pkChr->GetX() - m_pkGM->GetX(), pkChr->GetY() - m_pkGM->GetY()); if (!m_bAll && iDist >= 1000) // 10¹ÌÅÍ ÀÌ»ó¿¡ ÀÖ´Â °ÍµéÀº purge ÇÏÁö ¾Ê´Â´Ù. return; if (pkChr->IsNPC()) pkChr->PointChange(POINT_HP, (10 - pkChr->GetHP())); } }; ACMD(do_weaken) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); FuncWeaken func(ch); if (*arg1 && !strcmp(arg1, "all")) func.m_bAll = true; ch->GetSectree()->ForEachAround(func); } ACMD(do_getqf) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); LPCHARACTER tch; if (!*arg1) tch = ch; else { tch = CHARACTER_MANAGER::instance().FindPC(arg1); if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "There is no such character."); return; } } quest::PC* pPC = quest::CQuestManager::instance().GetPC(tch->GetPlayerID()); if (pPC) pPC->SendFlagList(ch); } ACMD(do_set_state) { char arg1[256]; char arg2[256]; //argument = one_argument(argument, arg1, sizeof(arg1)); two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1 || !*arg2) return; quest::PC* pPC = quest::CQuestManager::instance().GetPCForce(ch->GetPlayerID()); std::string questname = arg1; std::string statename = arg2; if (!questname.empty()) { int value = quest::CQuestManager::Instance().GetQuestStateIndex(questname, statename); pPC->SetFlag(questname + ".__status", value); pPC->ClearTimer(); quest::PC::QuestInfoIterator it = pPC->quest_begin(); unsigned int questindex = quest::CQuestManager::instance().GetQuestIndexByName(questname); while (it!= pPC->quest_end()) { if (it->first == questindex) { it->second.st = value; break; } ++it; } ch->ChatPacket(CHAT_TYPE_INFO, "setting quest state flag %s %s %d", questname.c_str(), arg1, value); } else { ch->ChatPacket(CHAT_TYPE_INFO, "setting quest state flag failed"); } } ACMD(do_setqf) { char arg1[256]; char arg2[256]; char arg3[256]; one_argument(two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)), arg3, sizeof(arg3)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: setqf []"); return; } LPCHARACTER tch = ch; if (*arg3) tch = CHARACTER_MANAGER::instance().FindPC(arg3); if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "There is no such character."); return; } quest::PC* pPC = quest::CQuestManager::instance().GetPC(tch->GetPlayerID()); if (pPC) { int value = 0; str_to_number(value, arg2); pPC->SetFlag(arg1, value); ch->ChatPacket(CHAT_TYPE_INFO, "Quest flag set: %s %d", arg1, value); } } ACMD(do_delqf) { char arg1[256]; char arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Syntax: delqf []"); return; } LPCHARACTER tch = ch; if (*arg2) tch = CHARACTER_MANAGER::instance().FindPC(arg2); if (!tch) { ch->ChatPacket(CHAT_TYPE_INFO, "There is no such character."); return; } quest::PC* pPC = quest::CQuestManager::instance().GetPC(tch->GetPlayerID()); if (pPC) { if (pPC->DeleteFlag(arg1)) ch->ChatPacket(CHAT_TYPE_INFO, "Delete success."); else ch->ChatPacket(CHAT_TYPE_INFO, "Delete failed. Quest flag does not exist."); } } ACMD(do_forgetme) { ch->ForgetMyAttacker(); } ACMD(do_aggregate) { ch->AggregateMonster(); } ACMD(do_attract_ranger) { ch->AttractRanger(); } ACMD(do_pull_monster) { ch->PullMonster(); } ACMD(do_polymorph) { char arg1[256], arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (*arg1) { DWORD dwVnum = 0; str_to_number(dwVnum, arg1); bool bMaintainStat = false; if (*arg2) { int value = 0; str_to_number(value, arg2); bMaintainStat = (value>0); } ch->SetPolymorph(dwVnum, bMaintainStat); } } ACMD(do_polymorph_item) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (*arg1) { DWORD dwVnum = 0; str_to_number(dwVnum, arg1); LPITEM item = ITEM_MANAGER::instance().CreateItem(70104, 1, 0, true); if (item) { item->SetSocket(0, dwVnum); int iEmptyPos = ch->GetEmptyInventory(item->GetSize()); if (iEmptyPos != -1) { item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos)); LogManager::instance().ItemLog(ch, item, "GM", item->GetName()); } else { M2_DESTROY_ITEM(item); ch->ChatPacket(CHAT_TYPE_INFO, "Not enough inventory space."); } } else { ch->ChatPacket(CHAT_TYPE_INFO, "#%d item not exist by that vnum.", 70103); } //ch->SetPolymorph(dwVnum, bMaintainStat); } } ACMD(do_priv_empire) { char arg1[256] = {0}; char arg2[256] = {0}; char arg3[256] = {0}; char arg4[256] = {0}; int empire = 0; int type = 0; int value = 0; int duration = 0; const char* line = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (!*arg1 || !*arg2) goto USAGE; if (!line) goto USAGE; two_arguments(line, arg3, sizeof(arg3), arg4, sizeof(arg4)); if (!*arg3 || !*arg4) goto USAGE; str_to_number(empire, arg1); str_to_number(type, arg2); str_to_number(value, arg3); value = MINMAX(0, value, 1000); str_to_number(duration, arg4); if (empire < 0 || 3 < empire) goto USAGE; if (type < 1 || 4 < type) goto USAGE; if (value < 0) goto USAGE; if (duration < 0) goto USAGE; // ½Ã°£ ´ÜÀ§·Î º¯°æ duration = duration * (60*60); sys_log(0, "_give_empire_privileage(empire=%d, type=%d, value=%d, duration=%d) by command", empire, type, value, duration); CPrivManager::instance().RequestGiveEmpirePriv(empire, type, value, duration); return; USAGE: ch->ChatPacket(CHAT_TYPE_INFO, "usage : priv_empire "); ch->ChatPacket(CHAT_TYPE_INFO, " 0 - 3 (0==all)"); ch->ChatPacket(CHAT_TYPE_INFO, " 1:item_drop, 2:gold_drop, 3:gold10_drop, 4:exp"); ch->ChatPacket(CHAT_TYPE_INFO, " percent"); ch->ChatPacket(CHAT_TYPE_INFO, " hour"); } /** * @version 05/06/08 Bang2ni - ±æµå º¸³Ê½º Äù½ºÆ® ÁøÇà ¾ÈµÇ´Â ¹®Á¦ ¼öÁ¤.(½ºÅ©¸³Æ®°¡ ÀÛ¼º¾ÈµÊ.) * quest/priv_guild.quest ·Î ºÎÅÍ ½ºÅ©¸³Æ® Àоî¿À°Ô ¼öÁ¤µÊ */ ACMD(do_priv_guild) { static const char msg[] = { '\0' }; char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (*arg1) { CGuild * g = CGuildManager::instance().FindGuildByName(arg1); if (!g) { DWORD guild_id = 0; str_to_number(guild_id, arg1); g = CGuildManager::instance().FindGuild(guild_id); } if (!g) ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±×·± À̸§ ¶Ç´Â ¹øÈ£ÀÇ ±æµå°¡ ¾ø½À´Ï´Ù.")); else { char buf[1024+1]; snprintf(buf, sizeof(buf), msg, g->GetID()); using namespace quest; PC * pc = CQuestManager::instance().GetPC(ch->GetPlayerID()); QuestState qs = CQuestManager::instance().OpenState("ADMIN_QUEST", QUEST_FISH_REFINE_STATE_INDEX); luaL_loadbuffer(qs.co, buf, strlen(buf), "ADMIN_QUEST"); pc->SetQuest("ADMIN_QUEST", qs); QuestState & rqs = *pc->GetRunningQuestState(); if (!CQuestManager::instance().RunState(rqs)) { CQuestManager::instance().CloseState(rqs); pc->EndRunning(); return; } } } } ACMD(do_mount_test) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (*arg1) { DWORD vnum = 0; str_to_number(vnum, arg1); ch->MountVnum(vnum); } } ACMD(do_observer) { ch->SetObserverMode(!ch->IsObserverMode()); } ACMD(do_socket_item) { char arg1[256], arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); if (*arg1) { DWORD dwVnum = 0; str_to_number(dwVnum, arg1); int iSocketCount = 0; str_to_number(iSocketCount, arg2); if (!iSocketCount || iSocketCount >= ITEM_SOCKET_MAX_NUM) iSocketCount = 3; if (!dwVnum) { if (!ITEM_MANAGER::instance().GetVnum(arg1, dwVnum)) { ch->ChatPacket(CHAT_TYPE_INFO, "#%d item not exist by that vnum.", dwVnum); return; } } LPITEM item = ch->AutoGiveItem(dwVnum); if (item) { for (int i = 0; i < iSocketCount; ++i) item->SetSocket(i, 1); } else { ch->ChatPacket(CHAT_TYPE_INFO, "#%d cannot create item.", dwVnum); } } } ACMD(do_xmas) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); int flag = 0; if (*arg1) str_to_number(flag, arg1); switch (subcmd) { case SCMD_XMAS_SNOW: quest::CQuestManager::instance().RequestSetEventFlag("xmas_snow", flag); break; case SCMD_XMAS_BOOM: quest::CQuestManager::instance().RequestSetEventFlag("xmas_boom", flag); break; case SCMD_XMAS_SANTA: quest::CQuestManager::instance().RequestSetEventFlag("xmas_santa", flag); break; } } // BLOCK_CHAT ACMD(do_block_chat_list) { // GMÀÌ ¾Æ´Ï°Å³ª block_chat_privilege°¡ ¾ø´Â »ç¶÷Àº ¸í·É¾î »ç¿ë ºÒ°¡ if (!ch || (ch->GetGMLevel() < GM_HIGH_WIZARD && ch->GetQuestFlag("chat_privilege.block") <= 0)) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±×·± ¸í·É¾î´Â ¾ø½À´Ï´Ù")); return; } DBManager::instance().ReturnQuery(QID_BLOCK_CHAT_LIST, ch->GetPlayerID(), NULL, "SELECT p.name, a.lDuration FROM affect%s as a, player%s as p WHERE a.bType = %d AND a.dwPID = p.id", get_table_postfix(), get_table_postfix(), AFFECT_BLOCK_CHAT); } ACMD(do_vote_block_chat) { return; char arg1[256]; argument = one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: vote_block_chat "); return; } const char* name = arg1; long lBlockDuration = 10; sys_log(0, "vote_block_chat %s %d", name, lBlockDuration); LPCHARACTER tch = CHARACTER_MANAGER::instance().FindPC(name); if (!tch) { CCI * pkCCI = P2P_MANAGER::instance().Find(name); if (pkCCI) { TPacketGGBlockChat p; p.bHeader = HEADER_GG_BLOCK_CHAT; strlcpy(p.szName, name, sizeof(p.szName)); p.lBlockDuration = lBlockDuration; P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGBlockChat)); } else { TPacketBlockChat p; strlcpy(p.szName, name, sizeof(p.szName)); p.lDuration = lBlockDuration; db_clientdesc->DBPacket(HEADER_GD_BLOCK_CHAT, ch ? ch->GetDesc()->GetHandle() : 0, &p, sizeof(p)); } if (ch) ch->ChatPacket(CHAT_TYPE_INFO, "Chat block requested."); return; } if (tch && ch != tch) tch->AddAffect(AFFECT_BLOCK_CHAT, POINT_NONE, 0, AFF_NONE, lBlockDuration, 0, true); } ACMD(do_block_chat) { // GMÀÌ ¾Æ´Ï°Å³ª block_chat_privilege°¡ ¾ø´Â »ç¶÷Àº ¸í·É¾î »ç¿ë ºÒ°¡ if (ch && (ch->GetGMLevel() < GM_HIGH_WIZARD && ch->GetQuestFlag("chat_privilege.block") <= 0)) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±×·± ¸í·É¾î´Â ¾ø½À´Ï´Ù")); return; } char arg1[256]; argument = one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) { if (ch) ch->ChatPacket(CHAT_TYPE_INFO, "Usage: block_chat