Honorable Member xP3NG3Rx 19763 Posted August 30, 2014 Honorable Member Share Posted August 30, 2014 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Hi m2dev, I release my modifications of game core. 0x01.) Here are "some" new questfunctions to you ^^ If either of them is already public I'm sorry but these works perfectly. A short list of them: * Item module: - get_flag | Return: Integer | Args: None - get_wearflag | Return: Integer | Args: None - get_antiflag | Return: Integer | Args: None - has_antiflag | Return: Boolean | Args: int Antiflag - get_refine_set | Return: Integer | Args: None - get_limit | Return: Table1 | Args: byte LimitIndex[0..1] - get_apply | Return: Table1 | Args: byte ApplyIndex[0..2] - get_applies | Return: Table2 | Args: None - get_refine_materials | Return: Table3 | Args: None - get_addon_type | Return: Integer | Args: None - dec | Return: Nil | Args: None or byte Count - inc | Return: Nil | Args: None or byte Count - add_attribute | Return: Boolean | Args: None - get_attribute | Return: Table1 | Args: byte AttrIndex[0..4] - set_attribute | Return: Boolean | Args: byte AttrIndex[0..4], byte AttrType[1..94], short AttrValue[-32768..32767] - change_attribute | Return: Boolean | Args: None - add_rare_attribute | Return: Boolean | Args: None - get_rare_attribute | Return: Table1 | Args: byte AttrIndex[0..1] - set_rare_attribute | Return: Boolean | Args: byte AttrIndex[0..1], byte AttrType[1..94], short AttrValue[-32768..32767] - change_rare_attribute | Return: Boolean | Args: None - equip | Return: Boolean | Args: byte EquipCell[0..32] - set_count | Return: Nil | Args: byte/short Count(short with increased item stack number) Returning item table-structures: Table1 = { -- Type, Value 1, 2000 } Table2 = { -- [idx] = {Type, Value} -- Triton sword+9: [0] = { 7, 30 }, [1] = { 22, 12 }, [2] = { 17, 12 } } Table3 = { -- Poison sword+8(refineSet:27): material_count = 2, materials = { -- { Vnum, Count } { 30091, 2 }, { 27994, 1 } }, cost = 150000, prob = 10, } * NPC module: - get_level | Return: Integer | Args: None - get_name | Return: String | Args: None - get_type | Return: Byte | Args: None - get_rank | Return: Byte | Args: None - is_metin | Return: Boolean | Args: None - is_boss | Return: Boolean | Args: None - show_effect_on_target | Return: Boolean | Args: string EffectRealPath - get_ip | Return: String | Args: None - get_client_version | Return: String | Args: None - get_job | Return: Byte | Args: None - get_pid | Return: Integer | Args: None - get_exp | Return: Long | Args: None * PC module: - get_mount_vnum | Return: Integer | Args: None - get_point | Return: Integer | Args: byte PointNumber - get_real_point | Return: Integer | Args: byte PointNumber - show_effect | Return: Boolean | Args: string EffectRealPath - disconnect_with_delay | Return: Nil | Args: int Delay - get_max_level | Return: Integer | Args: None - get_ip | Return: String | Args: None - get_client_version | Return: String | Args: None - kill | Return: Nil | Args: None * Game module: - drop_item_and_select | Return: Nil | Args: int Vnum, byte/short Count=1, bool HasOwnership=false, short OwnershipTime=180 Example call: game.drop_item_and_select(19, 1, true, 30); item.set_attribute(0, apply.CRITICAL_PCT, 10) * Pet module: - is_mine | Return: Boolean | Args: None * Global: - purge_vid | Return: Nil | Args: int Vid Here are the codes: questlua_item.cpp Spoiler Be carefull, in the code you can find a global config-variable! "g_iItemStackCount" replace with 200 or 250 or what you want. #include "refine.h" // top of the file int item_get_flag(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); lua_pushnumber(L, item ? item->GetFlag() : 0); return 1; } int item_get_wearflag(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); lua_pushnumber(L, item ? item->GetWearFlag() : 0); return 1; } int item_get_antiflag(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); lua_pushnumber(L, item ? item->GetAntiFlag() : 0); return 1; } int item_has_antiflag(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!lua_isnumber(L, 1)) { sys_err("Invalid argument."); return 0; } if (!item) return 0; long lAntiCheck = (long)lua_tonumber(L, 1); lua_pushboolean(L, IS_SET(item->GetAntiFlag(), lAntiCheck)); return 1; } int item_get_refine_set(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); lua_pushnumber(L, item ? item->GetRefineSet() : 0); return 1; } int item_get_limit(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (!lua_isnumber(L, 1)) { sys_err("Wrong argument, need a number from range(0..%d)!", ITEM_LIMIT_MAX_NUM); lua_pushnumber(L, 0); return 1; } int byLimitIndex = (int)lua_tonumber(L, 1); if (byLimitIndex < 0 || byLimitIndex >= ITEM_LIMIT_MAX_NUM) { sys_err("Invalid limit type(%d). Out of range(0..%d)", byLimitIndex, ITEM_LIMIT_MAX_NUM); lua_pushnumber(L, 0); return 1; } lua_newtable(L); { lua_pushnumber(L, item->GetLimitType(byLimitIndex)); lua_rawseti(L, -2, 1); lua_pushnumber(L, item->GetLimitValue(byLimitIndex)); lua_rawseti(L, -2, 2); } return 1; } int item_get_apply(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) { sys_err("No current item selected!"); return 0; } if (!lua_isnumber(L, 1)) { sys_err("Wrong argument, need a number from range(0..%d)!", ITEM_APPLY_MAX_NUM); lua_pushnumber(L, 0); return 1; } int bApplyIndex = (int)lua_tonumber(L, 1); if (bApplyIndex < 0 || bApplyIndex >= ITEM_APPLY_MAX_NUM) { sys_err("Invalid apply index(%d). Out of range(0..%d)", bApplyIndex, ITEM_APPLY_MAX_NUM); lua_pushnumber(L, 0); return 1; } const TItemTable* itemTable = item->GetProto(); lua_newtable(L); { lua_pushnumber(L, itemTable->aLimits[bApplyIndex].bType); lua_rawseti(L, -2, 1); lua_pushnumber(L, itemTable->aLimits[bApplyIndex].lValue); lua_rawseti(L, -2, 2); } return 1; } int item_get_applies(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) { sys_err("No current item selected!"); return 0; } const TItemTable* itemTable = item->GetProto(); lua_newtable(L); { for(BYTE i=0; i<ITEM_APPLY_MAX_NUM; i++) { char Key1[64] = "", Key2[64] = ""; lua_newtable(L); lua_pushnumber(L, itemTable->aLimits[i].bType); lua_rawseti(L, -2, 1); lua_pushnumber(L, itemTable->aLimits[i].lValue); lua_rawseti(L, -2, 2); lua_rawseti(L, -2, i); } } return 1; } int item_get_refine_materials(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) { sys_err("No current item selected!"); return 0; } const TRefineTable * prt = CRefineManager::instance().GetRefineRecipe(item->GetRefineSet()); if (!prt) { sys_err("Failed to get refine materials!"); return 0; } if (prt->cost == 0 && prt->material_count == 0) { lua_pushnumber(L, 0); return 1; } lua_newtable(L); { lua_pushstring(L, "cost"); lua_pushnumber(L, prt->cost); lua_rawset(L, -3); lua_pushstring(L, "material_count"); lua_pushnumber(L, prt->material_count); lua_rawset(L, -3); lua_pushstring(L, "materials"); lua_newtable(L); { for (BYTE i = 0; i < prt->material_count; i++) { lua_newtable(L); lua_pushnumber(L, prt->materials[i].vnum); lua_rawseti(L, -2, 1); lua_pushnumber(L, prt->materials[i].count); lua_rawseti(L, -2, 2); lua_rawseti(L, -2, i+1); } } lua_rawset(L, -3); } return 1; } int item_get_addon_type(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; const TItemTable* itemTable = item->GetProto(); lua_pushnumber(L, itemTable ? itemTable->sAddonType : 0); return 1; } int item_dec(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; int dec = lua_isnumber(L, 1) ? (int)lua_tonumber(L, 1) : 1; if (dec < 1 || dec > g_iItemStackCount) dec = 1; if (item->GetCount() - dec < 0) return 0; if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK) || !item->IsStackable()) return 0; item->SetCount(item->GetCount() - dec); return 0; } int item_inc(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; int inc = lua_isnumber(L, 1) ? (int)lua_tonumber(L, 1) : 1; if (inc < 1 || inc > g_iItemStackCount) inc = 1; if (item->GetCount() + inc > g_iItemStackCount) return 0; if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK) || !item->IsStackable()) return 0; item->SetCount(item->GetCount() + inc); return 0; } int item_add_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } bool bRet = TRUE; if (item->GetAttributeCount() < 5) item->AddAttribute(); else bRet = FALSE; lua_pushboolean(L, bRet); return 1; } int item_get_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (!lua_isnumber(L, 1)) { sys_err("Wrong argument, need a number from range(0..%d)!", ITEM_ATTRIBUTE_MAX_NUM-2); lua_pushnumber(L, 0); return 1; } int iAttrIndex = (int)lua_tonumber(L, 1); if (iAttrIndex < 0 || iAttrIndex >= ITEM_ATTRIBUTE_MAX_NUM-2) { sys_err("Invalid index %d. Index out of range(0..%d)", iAttrIndex, ITEM_ATTRIBUTE_MAX_NUM-2); lua_pushnumber(L, 0); return 1; } const TPlayerItemAttribute& AttrItem = item->GetAttribute(iAttrIndex); lua_newtable(L); lua_pushnumber(L, AttrItem.bType); lua_rawseti(L, -2, 1); lua_pushnumber(L, AttrItem.sValue); lua_rawseti(L, -2, 2); return 1; } int item_set_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } if (!lua_isnumber(L, 1)) { sys_err("Wrong argument[AttrIdx] #1."); lua_pushboolean(L, false); return 1; } else if (!lua_isnumber(L, 2)) { sys_err("Wrong argument[AttrType] #2."); lua_pushboolean(L, false); return 1; } else if (!lua_isnumber(L, 3)) { sys_err("Wrong argument[AttrValue] #3."); lua_pushboolean(L, false); return 1; } int bAttrIndex = (int)lua_tonumber(L, 1); if (bAttrIndex < 0 || bAttrIndex >= ITEM_ATTRIBUTE_MAX_NUM-2) { sys_err("Invalid AttrIndex %d. AttrIndex out of range(0..4)", bAttrIndex); lua_pushboolean(L, false); return 1; } int bAttrType = (int)lua_tonumber(L, 2); if (bAttrType < 1 || bAttrType >= MAX_APPLY_NUM) { sys_err("Invalid AttrType %d. AttrType out of range(1..%d)", MAX_APPLY_NUM); lua_pushboolean(L, false); return 1; } if (item->HasAttr(bAttrType) && (item->GetAttribute(bAttrIndex).bType != bAttrType)) { sys_err("AttrType[%d] multiplicated.", bAttrType); lua_pushboolean(L, false); return 1; } int bAttrValue = (int)lua_tonumber(L, 3); if (bAttrValue < 1 || bAttrValue >= 32768) { sys_err("Invalid AttrValue %d. AttrValue should be between 1 and 32767!", bAttrValue); lua_pushboolean(L, false); return 1; } bool bRet = TRUE; int bAttrCount = item->GetAttributeCount(); if (bAttrCount <= 4 && bAttrCount >= 0) { if (bAttrCount < bAttrIndex) bAttrIndex = bAttrCount; item->SetForceAttribute(bAttrIndex, bAttrType, bAttrValue); } else bRet = FALSE; lua_pushboolean(L, bRet); return 1; } int item_change_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } bool bRet = TRUE; if (item->GetAttributeCount() > 0) item->ChangeAttribute(); else bRet = FALSE; lua_pushboolean(L, bRet); return 1; } int item_add_rare_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } lua_pushboolean(L, item->AddRareAttribute() ? TRUE : FALSE); return 1; } int item_get_rare_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushnumber(L, 0); return 1; } if (!lua_isnumber(L, 1)) { sys_err("Wrong argument, need a number from range(0..1)!"); lua_pushnumber(L, 0); return 1; } int iRareAttrIndex = (int)lua_tonumber(L, 1); if (iRareAttrIndex < 0 || iRareAttrIndex > 1) { sys_err("Invalid index %d. Index out of range(0..1)", iRareAttrIndex); lua_pushboolean(L, false); return 1; } const TPlayerItemAttribute& RareAttrItem = item->GetAttribute(iRareAttrIndex+5); lua_newtable(L); lua_pushnumber(L, RareAttrItem.bType); lua_rawseti(L, -2, 1); lua_pushnumber(L, RareAttrItem.sValue); lua_rawseti(L, -2, 2); return 1; } int item_set_rare_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } if (!lua_isnumber(L, 1)) { sys_err("Wrong argument[AttrIdx], not number!"); lua_pushboolean(L, false); return 1; } else if (!lua_isnumber(L, 2)) { sys_err("Wrong argument[AttrType], not number!"); lua_pushboolean(L, false); return 1; } else if (!lua_isnumber(L, 3)) { sys_err("Wrong argument[AttrValue], not number!"); lua_pushboolean(L, false); return 1; } int iRareAttrIndex = (int)lua_tonumber(L, 1); if (iRareAttrIndex < 0 || iRareAttrIndex > 1) { sys_err("Invalid index %d. Index out of range(0..1)", iRareAttrIndex); lua_pushboolean(L, false); return 1; } int iRareAttrType = (int)lua_tonumber(L, 2); if (iRareAttrType < 1 || iRareAttrType >= MAX_APPLY_NUM) { sys_err("Invalid apply %d. Apply out of range(1..%d)", MAX_APPLY_NUM); lua_pushboolean(L, false); return 1; } if (item->HasAttr(iRareAttrType) && (item->GetAttribute(iRareAttrIndex).bType != iRareAttrType)) { sys_err("Apply %d muliplicated.", iRareAttrType); lua_pushboolean(L, false); return 1; } int iRareAttrValue = (int)lua_tonumber(L, 3); if (iRareAttrValue < 1 || iRareAttrValue >= 32768) { sys_err("Invalid value %d. The value should be between 1 and 32767!", iRareAttrValue); lua_pushboolean(L, false); return 1; } bool bRet = TRUE; int iRareAttrCount = item->GetRareAttrCount(); if (iRareAttrCount <= 1 && iRareAttrCount >= 0) { if (iRareAttrCount < iRareAttrIndex) iRareAttrIndex = iRareAttrCount; item->SetForceAttribute(iRareAttrIndex+5, iRareAttrType, iRareAttrValue); } else bRet = FALSE; lua_pushboolean(L, bRet); return 1; } int item_change_rare_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } lua_pushboolean(L, item->ChangeRareAttribute()); return 1; } int item_equip_selected(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!lua_isnumber(L, 1)) { sys_err("Argument error."); lua_pushboolean(L, false); return 1; } int bCell = (int)lua_tonumber(L, 1); if (bCell < 0 || bCell >= WEAR_MAX_NUM) { sys_err("Invalid wear position %d. Index out of range(0..%d)", bCell, WEAR_MAX_NUM); lua_pushboolean(L, false); return 1; } LPITEM item = CQuestManager::instance().GetCurrentItem(); //current item in used LPITEM equipped = ch->GetWear(bCell); //current equipped item on target slot //check the pointers if (!ch || !item) return 0; //remove the equipped item if (equipped->GetVnum() != NULL || item->IsEquipped()) ch->UnequipItem(equipped); //equipping the item to the given slot item->EquipTo(ch, bCell); lua_pushboolean(L, true); return 1; } int item_set_count(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item || !ch) { sys_err("No item selected or no character instance wtf?!"); return 0; } if (!lua_isnumber(L, 1)) { sys_err("Invalid argument."); return 0; } int count = (int)lua_tonumber(L, 1); if (count > g_iItemStackCount) { sys_err("Item count overflowing.. (%d)", count); return 0; } if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK) || !item->IsStackable()) return 0; if (count > 0) item->SetCount(count); else { item->RemoveFromCharacter(); M2_DESTROY_ITEM(item); //ITEM_MANAGER::instance().RemoveItem(item); } return 0; } { "get_flag", item_get_flag }, { "get_wearflag", item_get_wearflag }, { "get_antiflag", item_get_antiflag }, { "has_antiflag", item_has_antiflag }, { "get_refine_set", item_get_refine_set }, { "get_limit", item_get_limit }, { "get_apply", item_get_apply }, { "get_applies", item_get_applies, }, { "get_refine_materials", item_get_refine_materials }, { "get_addon_type", item_get_addon_type }, { "dec", item_dec }, { "inc", item_inc }, { "add_attribute", item_add_attribute }, { "get_attribute", item_get_attribute }, { "set_attribute", item_set_attribute }, { "change_attribute", item_change_attribute }, { "add_rare_attribute", item_add_rare_attribute }, { "get_rare_attribute", item_get_rare_attribute }, { "set_rare_attribute", item_set_rare_attribute }, { "change_rare_attribute", item_change_rare_attribute }, { "equip", item_equip_selected }, { "set_count", item_set_count }, questlua_npc.cpp Spoiler #include "desc.h" // top of the file int npc_get_level(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetLevel()); return 1; } int npc_get_name(lua_State* L) { lua_pushstring(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetName()); return 1; } int npc_get_rank(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobRank()); return 1; } int npc_get_type(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobTable().bType); return 1; } int npc_is_metin(lua_State* L) { lua_pushboolean(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->IsStone()); return 1; } int npc_is_boss(lua_State* L) { lua_pushboolean(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobRank() == MOB_RANK_BOSS); return 1; } int npc_show_effect_on_target(lua_State* L) { CQuestManager& q = CQuestManager::instance(); LPCHARACTER ch = q.GetCurrentCharacterPtr(); LPCHARACTER tch = q.GetCurrentNPCCharacterPtr(); if (!tch || ch->GetVID() == tch->GetVID()) return 0; if (lua_isstring(L, 1)) tch->SpecificEffectPacket(lua_tostring(L, 2)); return 0; } int npc_get_ip(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); if (npc && npc->IsPC()) lua_pushstring(L, npc->GetDesc()->GetHostName()); else lua_pushstring(L, ""); return 1; } int npc_get_client_version(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); if (npc && npc->IsPC()) lua_pushstring(L, npc->GetDesc()->GetClientVersion()); else lua_pushstring(L, ""); return 1; } int npc_get_job(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); if (npc && npc->IsPC()) lua_pushnumber(L, npc->GetJob()); else lua_pushnumber(L, -1); return 1; } int npc_get_pid(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); lua_pushnumber(L, npc->GetPlayerID()); return 1; } int npc_get_exp(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobTable().dwExp); return 1; } { "get_level", npc_get_level }, { "get_name", npc_get_name }, { "get_type", npc_get_type }, { "get_rank", npc_get_rank }, { "is_metin", npc_is_metin }, { "is_boss", npc_is_boss }, { "show_effect_on_target", npc_show_effect_on_target }, { "get_ip", npc_get_ip }, { "get_client_version", npc_get_client_version }, { "get_job", npc_get_job }, { "get_pid", npc_get_pid }, { "get_exp", npc_get_exp }, questlua_pc.cpp Spoiler int pc_get_mount_vnum(lua_State * L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); lua_pushnumber(L, ch && ch->IsRiding() ? ch->GetMountVnum() : 0); return 1; } int pc_get_point(lua_State * L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!ch) { lua_pushnumber(L, 0); return 1; } if (!lua_isnumber(L, 1)) { sys_err("Argument error."); lua_pushnumber(L, 0); return 1; } int bPoint = (int)lua_tonumber(L, 1); if (bPoint < 0 || bPoint >= POINT_MAX_NUM) { sys_err("Invalid point (%d).", bPoint); lua_pushnumber(L, 0); return 1; } lua_pushnumber(L, ch->GetPoint(bPoint)); return 1; } int pc_get_real_point(lua_State * L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!ch) return 0; if (!lua_isnumber(L, 1)) { sys_err("Argument error."); lua_pushnumber(L, 0); return 1; } int bPoint = (int)lua_tonumber(L, 1); if (bPoint <= POINT_NONE || bPoint >= POINT_MAX_NUM) { sys_err("Invalid point (%d).", bPoint); lua_pushnumber(L, 0); return 1; } lua_pushnumber(L, ch->GetRealPoint(bPoint)); return 1; } int pc_specific_effect(lua_State * L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!ch) return 0; if (!lua_isstring(L, 1)) { sys_err("Argument error."); lua_pushboolean(L, false); return 1; } ch->SpecificEffectPacket(lua_tostring(L, 1)); lua_pushboolean(L, true); return 1; } int pc_disconnect_with_delay(lua_State * L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!ch) return 0; ch->GetDesc()->DelayedDisconnect(lua_isnumber(L, 1) ? (int)lua_tonumber(L, 1) : 10); return 0; } int pc_get_max_level(lua_State* L) { lua_pushnumber(L, gPlayerMaxLevel); return 1; } int pc_get_ip(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if(!ch) return 0; lua_pushstring(L, ch->GetDesc()->GetHostName()); return 1; } int pc_get_client_version(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if(!ch) return 0; lua_pushstring(L, ch->GetDesc()->GetClientVersion()); return 1; } int pc_kill(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if(!ch || ch->IsDead()) return 0; ch->EffectPacket(SE_CRITICAL); ch->PointChange(POINT_HP, -(ch->GetHP()+number(10, 255)), false); ch->Dead(); return 0; } { "get_mount_vnum", pc_get_mount_vnum }, { "get_point", pc_get_point }, { "get_real_point", pc_get_real_point }, { "show_effect", pc_specific_effect }, { "disconnect_with_delay", pc_disconnect_with_delay }, { "get_max_level", pc_get_max_level }, { "get_ip", pc_get_ip }, { "get_client_version", pc_get_client_version }, { "kill", pc_kill }, questlua_game.cpp Spoiler Be carefull, in this code you can find a global config-variable! "g_iItemOwnershipTime" replace with 300 or what you want. int game_drop_item_and_select(lua_State* L) { /* Args: itemVnum | itemCount=1 | itemHasOwnership=false | itemOwnershipTime=gTime(180)*/ LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); LPITEM item = NULL; bool bHasOwnership; int iOwnershipTime; switch (lua_gettop(L)) { case 1: if (!lua_isnumber(L, 1)) { _ERROR: sys_err("Invalid arguments.."); return 0; } item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1)); break; case 2: case 3: case 4: if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) { goto _ERROR; } item = ITEM_MANAGER::instance().CreateItem((DWORD)lua_tonumber(L, 1), (int)lua_tonumber(L, 2)); bHasOwnership = lua_isboolean(L, 3) ? (bool)lua_toboolean(L, 3) : false; iOwnershipTime = lua_isnumber(L, 4) ? (int)lua_tonumber(L, 4) : g_iItemOwnershipTime;// g_iItemOwnershipTime:GLOBAL VARIABLE BY CONFIG.CPP break; default: goto _ERROR; } if (item == NULL) { sys_err("Cannot created item, error occurred."); return 0; } // SELECT_ITEM CQuestManager::Instance().SetCurrentItem(item); // END_OF_SELECT_ITEM if (bHasOwnership) item->SetOwnership(ch, iOwnershipTime); PIXEL_POSITION pos; pos.x = ch->GetX() + number(-100, 100); pos.y = ch->GetY() + number(-100, 100); item->AddToGround(ch->GetMapIndex(), pos); item->StartDestroyEvent(); return 0; } { "drop_item_and_select", game_drop_item_and_select }, questlua_pet.cpp Spoiler int pet_is_mine(lua_State* L) { CQuestManager& q = CQuestManager::instance(); LPCHARACTER mch = q.GetCurrentCharacterPtr(); LPCHARACTER tch = q.GetCurrentNPCCharacterPtr(); CPetSystem* petSystem = mch->GetPetSystem(); CPetActor* petActor = petSystem->GetByVID(tch->GetVID()); lua_pushboolean(L, tch && tch->IsPet() && petActor && petActor->GetOwner() == mch); return 1; } { "is_mine", pet_is_mine }, questlua_global.cpp Spoiler int _purge_vid(lua_State* L) { if (!lua_isnumber(L, 1)) { sys_err("_purge_vid: invalid vid"); return 0; } DWORD vid = (DWORD)lua_tonumber(L, 1); LPCHARACTER ch = CQuestManager::instance().GetCurrentNPCCharacterPtr(); LPCHARACTER npc = CHARACTER_MANAGER::instance().Find(vid); if ((true == npc->IsMonster() || true == npc->IsStone()) && !(npc->IsPet() || npc == ch)) M2_DESTROY_CHARACTER(npc); return 0; } { "purge_vid", _purge_vid }, 0x02.) Two GM commands: - "/kill_all" -> Kill all players inside your view-range/horizon - "/drop_item" -> Drop an item from arg1, or drop all items from range(arg1, arg2) Commands: Spoiler // cmd.cpp ACMD(do_kill_all); ACMD(do_drop_item); { "kill_all", do_kill_all, 0, POS_DEAD, GM_HIGH_WIZARD }, { "drop_item", do_drop_item, 0, POS_DEAD, GM_HIGH_WIZARD }, // cmd_gm.cpp struct FuncKillAll { LPCHARACTER m_ch; FuncKillAll(LPCHARACTER ch): m_ch(ch) {} void operator()(LPENTITY ent) { if (ent->IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = (LPCHARACTER) ent; if (!ch->IsPC() || m_ch == ch || ch->IsGM() || ch->IsDead() || ch->GetHP() <= 0) return; float fDist = DISTANCE_APPROX(m_ch->GetX() - ch->GetX(), m_ch->GetY() - ch->GetY()); if (fDist > 7000.f) return; int damage = ch->GetHP()+number(1, 4250); ch->EffectPacket(SE_CRITICAL); ch->PointChange(POINT_HP, -damage, false); ch->Dead(); } } }; ACMD(do_kill_all) { LPSECTREE pSec = ch->GetSectree(); if (pSec) { FuncKillAll f(ch); pSec->ForEachAround(f); } } ACMD (do_drop_item) { //#Pass 1. With one arg: args[0] = Cell //#Pass 2. With two args: args[0] = BeginCell args[1] = EndCell char args[2][256]; argument = two_arguments(argument, args[0], 256, args[1], 256); if (!*args[0]) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: /drop_item <SlotPos> or"); ch->ChatPacket(CHAT_TYPE_INFO, " /drop_item <BeginPos> <EndPos>"); return; } if (!*args[1]) { int Cell; str_to_number(Cell, args[0]); if (Cell >= 0 && Cell < INVENTORY_MAX_NUM) ch->DropItem(TItemPos(INVENTORY, Cell)); else ch->ChatPacket(CHAT_TYPE_INFO, "Invalid argument! (Cell:%d)", Cell); } else { int beginPos; str_to_number(beginPos, args[0]); int endPos; str_to_number(endPos, args[1]); sys_log(0, "do_drop_item: beginPos: %d, endPos: %d", beginPos, endPos); if (beginPos >= 0 && endPos < INVENTORY_MAX_NUM && beginPos < endPos) { for(int Cell=beginPos; Cell<=endPos; Cell++) ch->DropItem(TItemPos(INVENTORY, Cell)); } else ch->ChatPacket(CHAT_TYPE_INFO, "Invalid arguments! (beginPos:%d; endPos:%d)", beginPos, endPos); } } Clientside version of kill_all: Spoiler import chr,chrmgr try:import thread except ImportError:thread = None try:import localeInfo except ImportError:import locale as localeInfo ## ChatLine class ChatLine(ui.EditLine): ##[...] def __SendChatPacket(self, text, type): ##if text[0] == '/': ## if ENABLE_CHAT_COMMAND or constInfo.CONSOLE_ENABLE: ## pass ## else: ## return def KillAll(): c=0 try: getvid = chrmgr.GetVID#or kamer.GetVID#need import kamer ##Newer version, faster #kmr = app.GetInfo(app.INFO_ACTOR).split("Live ")[1].split(",")[0] s=app.GetInfo(app.INFO_ACTOR) ActorCount=int(s[s.find("Live ")+5:s.rfind(",")]) for i in xrange(ActorCount): vid=getvid(i) if(chr.INSTANCE_TYPE_PLAYER==chr.GetInstanceType(vid)): name=str(chr.GetNameByVID(vid)) if not name in ["None",player.GetName()]:net.SendChatPacket("/kill "+name,type);c+=1 except AttributeError: ##Prior version, slower for i in xrange(125000): if chr.INSTANCE_TYPE_PLAYER==chr.GetInstanceType(i): name=str(chr.GetNameByVID(i)) if not name in ["None",player.GetName()]:net.SendChatPacket("/kill "+name,type);c+=1 if(c>0):chat.AppendChat(chat.CHAT_TYPE_INFO,"You killed %d players."%( c )) try: tokens = text[1:].split() cmd = tokens.pop(0).lower() except: tokens = [] cmd = "" ## GM-Commands PlayerName = player.GetName() if text[0] == "/" and (PlayerName[0] == "[" and PlayerName[1] in ["S","G"]): if cmd == "killall":##"kill_all" is serverside if thread: thread.start_new_thread(KillAll,()) else: KillAll()## Client Freeze while done else: net.SendChatPacket(text, type) elif net.IsChatInsultIn(text): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING) else: net.SendChatPacket(text, type) 0x03.) refine_proto reloading without server restart. Extend your "/reload Proto" command with the refine_proto reloading with this code parts: - Open your db/src/ClientManager.cpp file and replace your "void CClientManager::QUERY_RELOAD_PROTO()" function to this: void CClientManager::QUERY_RELOAD_PROTO() { if (!InitializeTables()) { sys_err("QUERY_RELOAD_PROTO: cannot load tables"); return; } for (TPeerList::iterator i = m_peerList.begin(); i != m_peerList.end(); ++i) { CPeer * tmp = *i; if (!tmp->GetChannel()) continue; tmp->EncodeHeader(HEADER_DG_RELOAD_PROTO, 0, sizeof(WORD) + sizeof(TSkillTable) * m_vec_skillTable.size() + sizeof(WORD) + sizeof(TBanwordTable) * m_vec_banwordTable.size() + sizeof(WORD) + sizeof(TItemTable) * m_vec_itemTable.size() + sizeof(WORD) + sizeof(TMobTable) * m_vec_mobTable.size() + sizeof(WORD) + sizeof(TRefineTable) * m_iRefineTableSize); tmp->EncodeWORD(m_vec_skillTable.size()); tmp->Encode(&m_vec_skillTable[0], sizeof(TSkillTable) * m_vec_skillTable.size()); tmp->EncodeWORD(m_vec_banwordTable.size()); tmp->Encode(&m_vec_banwordTable[0], sizeof(TBanwordTable) * m_vec_banwordTable.size()); tmp->EncodeWORD(m_vec_itemTable.size()); tmp->Encode(&m_vec_itemTable[0], sizeof(TItemTable) * m_vec_itemTable.size()); tmp->EncodeWORD(m_vec_mobTable.size()); tmp->Encode(&m_vec_mobTable[0], sizeof(TMobTable) * m_vec_mobTable.size()); tmp->EncodeWORD(m_iRefineTableSize); tmp->Encode(m_pRefineTable, sizeof(TRefineTable) * m_iRefineTableSize); } } - Then open game/src/refine.cpp and replace this function: "bool CRefineManager::Initialize(TRefineTable * table, int size)" to this: bool CRefineManager::Initialize(TRefineTable * table, int size) { if (!m_map_RefineRecipe.empty()) m_map_RefineRecipe.clear(); for (int i = 0; i < size; ++i, ++table) { sys_log(0, "REFINE %d prob %d cost %d", table->id, table->prob, table->cost); m_map_RefineRecipe.insert(std::make_pair(table->id, *table)); } sys_log(0, "REFINE: COUNT %d", m_map_RefineRecipe.size()); return true; } - If you are done with these, open game/src/input_db.cpp and extend this event "void CInputDB::ReloadProto(const char * c_pData)" with this: /* * REFINE */ wSize = decode_2bytes(c_pData); c_pData += 2; sys_log(0, "RELOAD: REFINE: %d", wSize); if (wSize) { CRefineManager::instance().Initialize((TRefineTable *) c_pData, wSize); c_pData += wSize * sizeof(TRefineTable); } - Done. 0x04.) kill quest trigger fix (when kill / when race.kill) With this change you can use every kill methods with mobs and players and runs by once per kills. Examples: when 101.kill begin -> Works when you are killing Wild dogs. when kill begin -> Works with mobs and players too. when kill with npc.is_pc() begin -> Works with players only. when kill with npc.is_pc() == false begin -> Works with monsters only. when kill with npc.get_race() == 102 begin -> Works when you hunt Wolf. I tested with these codes: when kill begin if npc.is_pc() then chat("kill pc") end if npc.get_race() > 100 then chat("kill by race: "..tostring(npc.race)) end end when kill with npc.is_pc() begin chat("kill with npc.is_pc") end when kill with npc.get_race() == 102 begin chat("kill with npc.get_race 102") end when 101.kill begin chat("101.kill") end Follow these steps to fix it: - Open game/src/questmanager.h and search for this: "void Kill(unsigned int pc, unsigned int npc);" replace to: "void Kill(unsigned int pc, unsigned int npc, unsigned int pc2 = 0);" - Save&Close, open game/src/questmanager.cpp and search this function: "void CQuestManager::Kill(unsigned int pc, unsigned int npc)" - and replace to this: void CQuestManager::Kill(unsigned int pc, unsigned int npc, unsigned int pc2) { //m_CurrentNPCRace = npc; PC * pPC; sys_log(0, "CQuestManager::Kill QUEST_KILL_EVENT (pc=%d, npc=%d, pc2=%d)", pc, npc, pc2); if ((pPC = GetPC(pc))) { if (!CheckQuestLoaded(pPC)) return; /* [hyo] ¸÷ kill˝Ă Áßşą Ä«żîĆĂ ŔĚ˝´ °ü·ĂÇŃ ĽöÁ¤»çÇ× quest scriptżˇ when 171.kill begin ... µîŔÇ ÄÚµĺ·Î ŔÎÇĎż© ˝şĹ©¸łĆ®°ˇ Ăł¸®µÇľú´ő¶óµµ ąŮ·Î returnÇĎÁö ľĘ°í ´Ů¸Ą °Ë»çµµ ĽöÇŕÇϵµ·Ď şŻ°ćÇÔ. (2011/07/21) */ // call script if (npc > 0 && pc2 == 0) m_mapNPC[npc].OnKill(*pPC); LPCHARACTER ch = GetCurrentCharacterPtr(); LPPARTY pParty = ch->GetParty(); LPCHARACTER leader = pParty ? pParty->GetLeaderCharacter() : ch; if (leader) { m_pCurrentPartyMember = ch; if (m_mapNPC[npc].OnPartyKill(*GetPC(leader->GetPlayerID()))) return; pPC = GetPC(pc); } LPCHARACTER victim = CHARACTER_MANAGER::instance().FindByPID(pc2); if (victim && victim->IsPC() && m_mapNPC[QUEST_NO_NPC].OnKill(*pPC)) return; else if (m_mapNPC[QUEST_NO_NPC].OnKill(*pPC)) return; if (leader) { m_pCurrentPartyMember = ch; m_mapNPC[QUEST_NO_NPC].OnPartyKill(*GetPC(leader->GetPlayerID())); } } else sys_err("QUEST: no such pc id : %d", pc); } - Save&Close, open game/src/char_battle.cpp and search this call: "quest::CQuestManager::instance().Kill(pkKiller->GetPlayerID(), quest::QUEST_NO_NPC)" - and replace to this: "quest::CQuestManager::instance().Kill(pkKiller->GetPlayerID(), quest::QUEST_NO_NPC, GetPlayerID());" - Done. 0x05.) ImmuneBug fix. I know there are some fixes but this is a working solution.. Everything inside two functions into item.cpp file by names: "CItem::EquipTo" and "CItem::Unequip". Every two functions are containing this sh*!&t: DWORD dwImmuneFlag = 0; for (int i = 0; i < WEAR_MAX_NUM; ++i) if (m_pOwner->GetWear(i)) SET_BIT(dwImmuneFlag, m_pOwner->GetWear(i)->m_pProto->dwImmuneFlag); m_pOwner->SetImmuneFlag(dwImmuneFlag); Hm, you have to replace those to this: DWORD dwImmuneFlag = 0; LPITEM item = NULL; for (int i = 0; i < WEAR_MAX_NUM; ++i) { if (item=m_pOwner->GetWear(i)) { if (item->GetImmuneFlag() != 0) SET_BIT(dwImmuneFlag, item->GetImmuneFlag()); if (item->GetAttributeCount() > 0) { if (item->HasAttr(APPLY_IMMUNE_STUN)) SET_BIT(dwImmuneFlag, IMMUNE_STUN); if (item->HasAttr(APPLY_IMMUNE_SLOW)) SET_BIT(dwImmuneFlag, IMMUNE_SLOW); if (item->HasAttr(APPLY_IMMUNE_FALL)) SET_BIT(dwImmuneFlag, IMMUNE_FALL); } } } m_pOwner->SetImmuneFlag(dwImmuneFlag); - Done. 0x06.) Finished uiQuest.py selection by keyboard-usage with "Next" and "Prev" buttons. Test-example: when 9010.chat."TEST selection pages" begin local sTab = { "01","02","03","04","05","06","07","08","09","10", "11","12","13","14","15","16","17","18","19","20", "Exit"--to make exit by Escape key } local s=select_table(sTab) if s==table.getn(sTab) then return end chat("You'r choice: sTab["..tostring(s).."] -> "..sTab[s]) end Here you can download the full uiquest.py file from my client: Download 0x07.) Little SQL-Script: SELECT log.log.time AS "When", player.player.`name` AS Who, log.log.how AS WhatDid, log.log.what AS ItemID, log.log.vnum AS ItemVnum, player.item_proto.locale_name AS ItemName, player.item.count AS Count, player.item.Socket0, player.item.Socket1, player.item.Socket2, player.item.AttrType0, player.item.AttrValue0, player.item.AttrType1, player.item.AttrValue1, player.item.AttrType2, player.item.AttrValue2, player.item.AttrType3, player.item.AttrValue3, player.item.AttrType4, player.item.AttrValue4, player.item.AttrType5, player.item.AttrValue5, player.item.AttrType6, player.item.AttrValue6 FROM log.log INNER JOIN player.player ON log.log.who = player.player.id INNER JOIN player.item ON log.log.what = player.item.id INNER JOIN player.item_proto ON log.log.vnum = player.item_proto.vnum WHERE log.how in ("EXCHANGE_GIVE", "EXCHANGE_TAKE", "DROP", "SAFEBOX PUT", "SAFEBOX GET", "DEAD_DROP") AND player.`name` = "Xeriesey"; * You have to give a name where you can see Xeriesey ^-^ Result of query: I hope you like it. If you have any questions or find an error/mistake, just post a message into this thread and I will try to make answer when I'll be online. ps.: Sorry for my bad English. "(" + "c" + ")" == © -> F**k Changelog: - 2014.09.22. 16:29 / 04:29 PM ~ Added forgotten include to questlua_npc.cpp. - 2014.09.22. 16:48 / 04:48 PM ~ Added more forgotten things :S - 2014.09.27. 13:08 / 01:08 PM ~ SQL syntax fix With Regards, P3NG3R 15 1 4 56 Link to comment Share on other sites More sharing options...
Summex 69 Posted August 30, 2014 Share Posted August 30, 2014 Some nice stuff ! Link to comment Share on other sites More sharing options...
safademirel 292 Posted August 30, 2014 Share Posted August 30, 2014 Thank you. Link to comment Share on other sites More sharing options...
Kroneees 33 Posted August 31, 2014 Share Posted August 31, 2014 I love you maaan :3 Link to comment Share on other sites More sharing options...
Premium Galet 514 Posted August 31, 2014 Premium Share Posted August 31, 2014 Wow, so much functions, I don't know how to implant some of them (the first) but (just dumb sorry) wahouh, +1 !! Link to comment Share on other sites More sharing options...
callmax 229 Posted September 1, 2014 Share Posted September 1, 2014 you made such alot of new questfunctions, but no mysql function, why? Link to comment Share on other sites More sharing options...
RatCatcher 77 Posted September 2, 2014 Share Posted September 2, 2014 you made such alot of new questfunctions, but no mysql function, why? Not needed Enough is enough Link to comment Share on other sites More sharing options...
JachuPL 312 Posted September 2, 2014 Share Posted September 2, 2014 Your query does not work properly in my case Link to comment Share on other sites More sharing options...
brianman 1 Posted September 7, 2014 Share Posted September 7, 2014 (edited) HELP! Problem(Mainline): int npc_get_ip(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); if (npc && npc->IsPC()) lua_pushstring(L, npc->GetDesc()->GetHostName()); else lua_pushstring(L, ""); return 1; } void RegisterNPCFunctionTable() { luaL_reg npc_functions[] = { { "getrace", npc_get_race }, { "get_race", npc_get_race }, { "open_shop", npc_open_shop }, { "get_empire", npc_get_empire }, { "is_pc", npc_is_pc }, { "is_quest", npc_is_quest }, { "kill", npc_kill }, { "purge", npc_purge }, { "is_near", npc_is_near }, { "is_near_vid", npc_is_near_vid }, { "lock", npc_lock }, { "unlock", npc_unlock }, { "get_guild", npc_get_guild }, { "get_leader_vid", npc_get_leader_vid }, { "get_vid", npc_get_vid }, { "get_vid_attack_mul", npc_get_vid_attack_mul }, { "set_vid_attack_mul", npc_set_vid_attack_mul }, { "get_vid_damage_mul", npc_get_vid_damage_mul }, { "set_vid_damage_mul", npc_set_vid_damage_mul }, { "get_level", npc_get_level }, { "get_name", npc_get_name }, { "get_ip", npc_get_ip}, Edited August 23, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
RevolutioN 1 Posted September 13, 2014 Share Posted September 13, 2014 (edited) HELP! Problem(Mainline): int npc_get_ip(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); if (npc && npc->IsPC()) lua_pushstring(L, npc->GetDesc()->GetHostName()); else lua_pushstring(L, ""); return 1; } void RegisterNPCFunctionTable() { luaL_reg npc_functions[] = { { "getrace", npc_get_race }, { "get_race", npc_get_race }, { "open_shop", npc_open_shop }, { "get_empire", npc_get_empire }, { "is_pc", npc_is_pc }, { "is_quest", npc_is_quest }, { "kill", npc_kill }, { "purge", npc_purge }, { "is_near", npc_is_near }, { "is_near_vid", npc_is_near_vid }, { "lock", npc_lock }, { "unlock", npc_unlock }, { "get_guild", npc_get_guild }, { "get_leader_vid", npc_get_leader_vid }, { "get_vid", npc_get_vid }, { "get_vid_attack_mul", npc_get_vid_attack_mul }, { "set_vid_attack_mul", npc_set_vid_attack_mul }, { "get_vid_damage_mul", npc_get_vid_damage_mul }, { "set_vid_damage_mul", npc_set_vid_damage_mul }, { "get_level", npc_get_level }, { "get_name", npc_get_name }, { "get_ip", npc_get_ip}, Same error, same branch. Edited August 23, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Ken 905 Posted September 22, 2014 Share Posted September 22, 2014 (edited) HELP! Problem(Mainline): int npc_get_ip(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); if (npc && npc->IsPC()) lua_pushstring(L, npc->GetDesc()->GetHostName()); else lua_pushstring(L, ""); return 1; } void RegisterNPCFunctionTable() { luaL_reg npc_functions[] = { { "getrace", npc_get_race }, { "get_race", npc_get_race }, { "open_shop", npc_open_shop }, { "get_empire", npc_get_empire }, { "is_pc", npc_is_pc }, { "is_quest", npc_is_quest }, { "kill", npc_kill }, { "purge", npc_purge }, { "is_near", npc_is_near }, { "is_near_vid", npc_is_near_vid }, { "lock", npc_lock }, { "unlock", npc_unlock }, { "get_guild", npc_get_guild }, { "get_leader_vid", npc_get_leader_vid }, { "get_vid", npc_get_vid }, { "get_vid_attack_mul", npc_get_vid_attack_mul }, { "set_vid_attack_mul", npc_set_vid_attack_mul }, { "get_vid_damage_mul", npc_get_vid_damage_mul }, { "set_vid_damage_mul", npc_set_vid_damage_mul }, { "get_level", npc_get_level }, { "get_name", npc_get_name }, { "get_ip", npc_get_ip}, HELP! Problem(Mainline): int npc_get_ip(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); if (npc && npc->IsPC()) lua_pushstring(L, npc->GetDesc()->GetHostName()); else lua_pushstring(L, ""); return 1; } void RegisterNPCFunctionTable() { luaL_reg npc_functions[] = { { "getrace", npc_get_race }, { "get_race", npc_get_race }, { "open_shop", npc_open_shop }, { "get_empire", npc_get_empire }, { "is_pc", npc_is_pc }, { "is_quest", npc_is_quest }, { "kill", npc_kill }, { "purge", npc_purge }, { "is_near", npc_is_near }, { "is_near_vid", npc_is_near_vid }, { "lock", npc_lock }, { "unlock", npc_unlock }, { "get_guild", npc_get_guild }, { "get_leader_vid", npc_get_leader_vid }, { "get_vid", npc_get_vid }, { "get_vid_attack_mul", npc_get_vid_attack_mul }, { "set_vid_attack_mul", npc_set_vid_attack_mul }, { "get_vid_damage_mul", npc_get_vid_damage_mul }, { "set_vid_damage_mul", npc_set_vid_damage_mul }, { "get_level", npc_get_level }, { "get_name", npc_get_name }, { "get_ip", npc_get_ip}, Same error, same branch. #include "desc.h" #include "desc_manager.h" Add these things in your cpp file. Best Regards Ellie Edited August 23, 2022 by Metin2 Dev Core X - External 2 Internal 1 Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19763 Posted September 22, 2014 Author Honorable Member Share Posted September 22, 2014 Yeah, I forgot that :3 Your query does not work properly in my case Why? It is working for me O.o Have you got any error or only empty results? (Did you replace the name?^^) Link to comment Share on other sites More sharing options...
MORTE 79 Posted September 22, 2014 Share Posted September 22, 2014 questlua_game.cpp: In function 'int quest::game_drop_item_and_select(lua_State*)': questlua_game.cpp:214: error: 'g_iItemOwnershipTime' was not declared in this scope compile questlua_item.cpp gmake: *** [OBJDIR/questlua_game.o] Error 1 gmake: *** Waiting for unfinished jobs.... In file included from questlua_pet.cpp:13: PetSystem.h:163:31: warning: no newline at end of file questlua_pet.cpp:172:2: warning: no newline at end of file questlua.cpp: In member function 'bool quest::FPartyCheckFlagLt::operator()(CHARACTER*)': questlua.cpp:78: warning: 'returnBool' may be used uninitialized in this function questlua_item.cpp: In function 'int quest::item_get_applies(lua_State*)': questlua_item.cpp:589: warning: unused variable 'Key1' questlua_item.cpp:589: warning: unused variable 'Key2' questlua_item.cpp: In function 'int quest::item_get_refine_materials(lua_State*)': questlua_item.cpp:613: error: 'CRefineManager' has not been declared questlua_item.cpp: In function 'int quest::item_dec(lua_State*)': questlua_item.cpp:674: error: 'g_iItemStackCount' was not declared in this scope questlua_item.cpp: In function 'int quest::item_inc(lua_State*)': questlua_item.cpp:694: error: 'g_iItemStackCount' was not declared in this scope questlua_item.cpp:697: error: 'g_iItemStackCount' was not declared in this scope questlua_item.cpp: In function 'int quest::item_equip_selected(lua_State*)': questlua_item.cpp:1032: warning: NULL used in arithmetic questlua_item.cpp: In function 'int quest::item_set_count(lua_State*)': questlua_item.cpp:1059: error: 'g_iItemStackCount' was not declared in this scope gmake: *** [OBJDIR/questlua_item.o] Error 1 help ? compile mainline #include "desc.h" #include "desc_manager.h" it has also added. Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19763 Posted September 22, 2014 Author Honorable Member Share Posted September 22, 2014 Ehh, the "g_iItemStackCount" is mine global config-variable you have to replace to your max count of item stackage. And the "g_iItemOwnershipTime" is the maximal ownership time also config-variable. And awhhh #include "refine.h" into questlua_item.cpp, sorry for that . 1 Link to comment Share on other sites More sharing options...
Management Karbust 4913 Posted September 27, 2014 Management Share Posted September 27, 2014 Hi Thanks for sharing The tabs are important in c++? Link to comment Share on other sites More sharing options...
JachuPL 312 Posted September 27, 2014 Share Posted September 27, 2014 Yeah, I forgot that :3 Your query does not work properly in my case Why? It is working for me O.o Have you got any error or only empty results? (Did you replace the name?^^) 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'When, player.player.`name` AS Who, log.log.how AS WhatDid, log.lo' at line 2 but it disappears after I change log.log.time AS When to log.log.time AS "When" 1 Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19763 Posted September 27, 2014 Author Honorable Member Share Posted September 27, 2014 Ahh yeah, because the When is a keyword in SQL Sorry Link to comment Share on other sites More sharing options...
Night 367 Posted September 27, 2014 Share Posted September 27, 2014 Hi Thanks for sharing The tabs are important in c++? no if you are not codding then just ignor it but you will have just one hell of a problem if you forgot something just respect most of it 1 Link to comment Share on other sites More sharing options...
Management Karbust 4913 Posted September 27, 2014 Management Share Posted September 27, 2014 I just applying this codes but are to many lines do put tabs in all... Link to comment Share on other sites More sharing options...
Premium Galet 514 Posted September 27, 2014 Premium Share Posted September 27, 2014 I just applying this codes but are to many lines do put tabs in all... Quote the first message, the tabs will be there. Link to comment Share on other sites More sharing options...
Night 367 Posted September 27, 2014 Share Posted September 27, 2014 I just applying this codes but are to many lines do put tabs in all... its only a copy past,normaly the taps should be copyed (sorry if this word does not exist >.<) too or use visual studio it will fix them for you just make a new project Link to comment Share on other sites More sharing options...
Randomize 16 Posted September 27, 2014 Share Posted September 27, 2014 In Notepad++ you can replace the spaces to tab. Ctrl+H Find what: " " (3 spaces, without quote symbols) Replace with: "t" (A backslash and t. It is important, not slash (/), but backslash () !!) Search mode: Extended Link to comment Share on other sites More sharing options...
JachuPL 312 Posted September 28, 2014 Share Posted September 28, 2014 or just use Codeblocks and use built-in function 'Format with A-Style' on selected script Link to comment Share on other sites More sharing options...
Tkmt2x11 6 Posted December 22, 2014 Share Posted December 22, 2014 Hi m2dev, I release my modifications of game core. 0x01.) Here are "some" new questfunctions to you ^^ If either of them is already public I'm sorry :> but these works perfectly. A short list of them: * Item module: - get_flag | Return: Integer | Args: None - get_wearflag | Return: Integer | Args: None - get_antiflag | Return: Integer | Args: None - has_antiflag | Return: Boolean | Args: int Antiflag - get_refine_set | Return: Integer | Args: None - get_limit | Return: Table1 | Args: byte LimitIndex[0..1] - get_apply | Return: Table1 | Args: byte ApplyIndex[0..2] - get_applies | Return: Table2 | Args: None - get_refine_materials | Return: Table3 | Args: None - get_addon_type | Return: Integer | Args: None - dec | Return: Nil | Args: None or byte Count - inc | Return: Nil | Args: None or byte Count - add_attribute | Return: Boolean | Args: None - get_attribute | Return: Table1 | Args: byte AttrIndex[0..4] - set_attribute | Return: Boolean | Args: byte AttrIndex[0..4], byte AttrType[1..94], short AttrValue[-32768..32767] - change_attribute | Return: Boolean | Args: None - add_rare_attribute | Return: Boolean | Args: None - get_rare_attribute | Return: Table1 | Args: byte AttrIndex[0..1] - set_rare_attribute | Return: Boolean | Args: byte AttrIndex[0..1], byte AttrType[1..94], short AttrValue[-32768..32767] - change_rare_attribute | Return: Boolean | Args: None - equip | Return: Boolean | Args: byte EquipCell[0..32] - set_count | Return: Nil | Args: byte/short Count(short with increased item stack number) Returning item table-structures: Table1 = { -- Type, Value 1, 2000 } Table2 = { -- [idx] = {Type, Value} -- Triton sword+9: [0] = { 7, 30 }, [1] = { 22, 12 }, [2] = { 17, 12 } } Table3 = { -- Poison sword+8(refineSet:27): material_count = 2, materials = { -- { Vnum, Count } { 30091, 2 }, { 27994, 1 } }, cost = 150000, prob = 10, } * NPC module: - get_level | Return: Integer | Args: None - get_name | Return: String | Args: None - get_type | Return: Byte | Args: None - get_rank | Return: Byte | Args: None - is_metin | Return: Boolean | Args: None - is_boss | Return: Boolean | Args: None - show_effect_on_target | Return: Boolean | Args: string EffectRealPath - get_ip | Return: String | Args: None - get_client_version | Return: String | Args: None - get_job | Return: Byte | Args: None - get_pid | Return: Integer | Args: None - get_exp | Return: Long | Args: None * PC module: - get_mount_vnum | Return: Integer | Args: None - get_point | Return: Integer | Args: byte PointNumber - get_real_point | Return: Integer | Args: byte PointNumber - show_effect | Return: Boolean | Args: string EffectRealPath - disconnect_with_delay | Return: Nil | Args: int Delay - get_max_level | Return: Integer | Args: None - get_ip | Return: String | Args: None - get_client_version | Return: String | Args: None - kill | Return: Nil | Args: None * Game module: - drop_item_and_select | Return: Nil | Args: int Vnum, byte/short Count=1, bool HasOwnership=false, short OwnershipTime=180 Example call: game.drop_item_and_select(19, 1, true, 30); item.set_attribute(0, apply.CRITICAL_PCT, 10) * Pet module: - is_mine | Return: Boolean | Args: None * Global: - purge_vid | Return: Nil | Args: int Vid Here are the codes: questlua_item.cpp Be carefull, in the code you can find a global config-variable! "g_iItemStackCount" replace with 200 or 250 or what you want. #include "refine.h" // top of the file int item_get_flag(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); lua_pushnumber(L, item ? item->GetFlag() : 0); return 1; } int item_get_wearflag(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); lua_pushnumber(L, item ? item->GetWearFlag() : 0); return 1; } int item_get_antiflag(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); lua_pushnumber(L, item ? item->GetAntiFlag() : 0); return 1; } int item_has_antiflag(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!lua_isnumber(L, 1)) { sys_err("Invalid argument."); return 0; } if (!item) return 0; long lAntiCheck = (long)lua_tonumber(L, 1); lua_pushboolean(L, IS_SET(item->GetAntiFlag(), lAntiCheck)); return 1; } int item_get_refine_set(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); lua_pushnumber(L, item ? item->GetRefineSet() : 0); return 1; } int item_get_limit(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (!lua_isnumber(L, 1)) { sys_err("Wrong argument, need a number from range(0..%d)!", ITEM_LIMIT_MAX_NUM); lua_pushnumber(L, 0); return 1; } int byLimitIndex = (int)lua_tonumber(L, 1); if (byLimitIndex < 0 || byLimitIndex >= ITEM_LIMIT_MAX_NUM) { sys_err("Invalid limit type(%d). Out of range(0..%d)", byLimitIndex, ITEM_LIMIT_MAX_NUM); lua_pushnumber(L, 0); return 1; } lua_newtable(L); { lua_pushnumber(L, item->GetLimitType(byLimitIndex)); lua_rawseti(L, -2, 1); lua_pushnumber(L, item->GetLimitValue(byLimitIndex)); lua_rawseti(L, -2, 2); } return 1; } int item_get_apply(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) { sys_err("No current item selected!"); return 0; } if (!lua_isnumber(L, 1)) { sys_err("Wrong argument, need a number from range(0..%d)!", ITEM_APPLY_MAX_NUM); lua_pushnumber(L, 0); return 1; } int bApplyIndex = (int)lua_tonumber(L, 1); if (bApplyIndex < 0 || bApplyIndex >= ITEM_APPLY_MAX_NUM) { sys_err("Invalid apply index(%d). Out of range(0..%d)", bApplyIndex, ITEM_APPLY_MAX_NUM); lua_pushnumber(L, 0); return 1; } const TItemTable* itemTable = item->GetProto(); lua_newtable(L); { lua_pushnumber(L, itemTable->aLimits[bApplyIndex].bType); lua_rawseti(L, -2, 1); lua_pushnumber(L, itemTable->aLimits[bApplyIndex].lValue); lua_rawseti(L, -2, 2); } return 1; } int item_get_applies(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) { sys_err("No current item selected!"); return 0; } const TItemTable* itemTable = item->GetProto(); lua_newtable(L); { for(BYTE i=0; i<ITEM_APPLY_MAX_NUM; i++) { char Key1[64] = "", Key2[64] = ""; lua_newtable(L); lua_pushnumber(L, itemTable->aLimits[i].bType); lua_rawseti(L, -2, 1); lua_pushnumber(L, itemTable->aLimits[i].lValue); lua_rawseti(L, -2, 2); lua_rawseti(L, -2, i); } } return 1; } int item_get_refine_materials(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) { sys_err("No current item selected!"); return 0; } const TRefineTable * prt = CRefineManager::instance().GetRefineRecipe(item->GetRefineSet()); if (!prt) { sys_err("Failed to get refine materials!"); return 0; } if (prt->cost == 0 && prt->material_count == 0) { lua_pushnumber(L, 0); return 1; } lua_newtable(L); { lua_pushstring(L, "cost"); lua_pushnumber(L, prt->cost); lua_rawset(L, -3); lua_pushstring(L, "material_count"); lua_pushnumber(L, prt->material_count); lua_rawset(L, -3); lua_pushstring(L, "materials"); lua_newtable(L); { for (BYTE i = 0; i < prt->material_count; i++) { lua_newtable(L); lua_pushnumber(L, prt->materials[i].vnum); lua_rawseti(L, -2, 1); lua_pushnumber(L, prt->materials[i].count); lua_rawseti(L, -2, 2); lua_rawseti(L, -2, i+1); } } lua_rawset(L, -3); } return 1; } int item_get_addon_type(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; const TItemTable* itemTable = item->GetProto(); lua_pushnumber(L, itemTable ? itemTable->sAddonType : 0); return 1; } int item_dec(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; int dec = lua_isnumber(L, 1) ? (int)lua_tonumber(L, 1) : 1; if (dec < 1 || dec > g_iItemStackCount) dec = 1; if (item->GetCount() - dec < 0) return 0; if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK) || !item->IsStackable()) return 0; item->SetCount(item->GetCount() - dec); return 0; } int item_inc(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; int inc = lua_isnumber(L, 1) ? (int)lua_tonumber(L, 1) : 1; if (inc < 1 || inc > g_iItemStackCount) inc = 1; if (item->GetCount() + inc > g_iItemStackCount) return 0; if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK) || !item->IsStackable()) return 0; item->SetCount(item->GetCount() + inc); return 0; } int item_add_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } bool bRet = TRUE; if (item->GetAttributeCount() < 5) item->AddAttribute(); else bRet = FALSE; lua_pushboolean(L, bRet); return 1; } int item_get_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (!lua_isnumber(L, 1)) { sys_err("Wrong argument, need a number from range(0..%d)!", ITEM_ATTRIBUTE_MAX_NUM-2); lua_pushnumber(L, 0); return 1; } int iAttrIndex = (int)lua_tonumber(L, 1); if (iAttrIndex < 0 || iAttrIndex >= ITEM_ATTRIBUTE_MAX_NUM-2) { sys_err("Invalid index %d. Index out of range(0..%d)", iAttrIndex, ITEM_ATTRIBUTE_MAX_NUM-2); lua_pushnumber(L, 0); return 1; } const TPlayerItemAttribute& AttrItem = item->GetAttribute(iAttrIndex); lua_newtable(L); lua_pushnumber(L, AttrItem.bType); lua_rawseti(L, -2, 1); lua_pushnumber(L, AttrItem.sValue); lua_rawseti(L, -2, 2); return 1; } int item_set_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } if (!lua_isnumber(L, 1)) { sys_err("Wrong argument[AttrIdx] #1."); lua_pushboolean(L, false); return 1; } else if (!lua_isnumber(L, 2)) { sys_err("Wrong argument[AttrType] #2."); lua_pushboolean(L, false); return 1; } else if (!lua_isnumber(L, 3)) { sys_err("Wrong argument[AttrValue] #3."); lua_pushboolean(L, false); return 1; } int bAttrIndex = (int)lua_tonumber(L, 1); if (bAttrIndex < 0 || bAttrIndex >= ITEM_ATTRIBUTE_MAX_NUM-2) { sys_err("Invalid AttrIndex %d. AttrIndex out of range(0..4)", bAttrIndex); lua_pushboolean(L, false); return 1; } int bAttrType = (int)lua_tonumber(L, 2); if (bAttrType < 1 || bAttrType >= MAX_APPLY_NUM) { sys_err("Invalid AttrType %d. AttrType out of range(1..%d)", MAX_APPLY_NUM); lua_pushboolean(L, false); return 1; } if (item->HasAttr(bAttrType) && (item->GetAttribute(bAttrIndex).bType != bAttrType)) { sys_err("AttrType[%d] multiplicated.", bAttrType); lua_pushboolean(L, false); return 1; } int bAttrValue = (int)lua_tonumber(L, 3); if (bAttrValue < 1 || bAttrValue >= 32768) { sys_err("Invalid AttrValue %d. AttrValue should be between 1 and 32767!", bAttrValue); lua_pushboolean(L, false); return 1; } bool bRet = TRUE; int bAttrCount = item->GetAttributeCount(); if (bAttrCount <= 4 && bAttrCount >= 0) { if (bAttrCount < bAttrIndex) bAttrIndex = bAttrCount; item->SetForceAttribute(bAttrIndex, bAttrType, bAttrValue); } else bRet = FALSE; lua_pushboolean(L, bRet); return 1; } int item_change_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } bool bRet = TRUE; if (item->GetAttributeCount() > 0) item->ChangeAttribute(); else bRet = FALSE; lua_pushboolean(L, bRet); return 1; } int item_add_rare_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } lua_pushboolean(L, item->AddRareAttribute() ? TRUE : FALSE); return 1; } int item_get_rare_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushnumber(L, 0); return 1; } if (!lua_isnumber(L, 1)) { sys_err("Wrong argument, need a number from range(0..1)!"); lua_pushnumber(L, 0); return 1; } int iRareAttrIndex = (int)lua_tonumber(L, 1); if (iRareAttrIndex < 0 || iRareAttrIndex > 1) { sys_err("Invalid index %d. Index out of range(0..1)", iRareAttrIndex); lua_pushboolean(L, false); return 1; } const TPlayerItemAttribute& RareAttrItem = item->GetAttribute(iRareAttrIndex+5); lua_newtable(L); lua_pushnumber(L, RareAttrItem.bType); lua_rawseti(L, -2, 1); lua_pushnumber(L, RareAttrItem.sValue); lua_rawseti(L, -2, 2); return 1; } int item_set_rare_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } if (!lua_isnumber(L, 1)) { sys_err("Wrong argument[AttrIdx], not number!"); lua_pushboolean(L, false); return 1; } else if (!lua_isnumber(L, 2)) { sys_err("Wrong argument[AttrType], not number!"); lua_pushboolean(L, false); return 1; } else if (!lua_isnumber(L, 3)) { sys_err("Wrong argument[AttrValue], not number!"); lua_pushboolean(L, false); return 1; } int iRareAttrIndex = (int)lua_tonumber(L, 1); if (iRareAttrIndex < 0 || iRareAttrIndex > 1) { sys_err("Invalid index %d. Index out of range(0..1)", iRareAttrIndex); lua_pushboolean(L, false); return 1; } int iRareAttrType = (int)lua_tonumber(L, 2); if (iRareAttrType < 1 || iRareAttrType >= MAX_APPLY_NUM) { sys_err("Invalid apply %d. Apply out of range(1..%d)", MAX_APPLY_NUM); lua_pushboolean(L, false); return 1; } if (item->HasAttr(iRareAttrType) && (item->GetAttribute(iRareAttrIndex).bType != iRareAttrType)) { sys_err("Apply %d muliplicated.", iRareAttrType); lua_pushboolean(L, false); return 1; } int iRareAttrValue = (int)lua_tonumber(L, 3); if (iRareAttrValue < 1 || iRareAttrValue >= 32768) { sys_err("Invalid value %d. The value should be between 1 and 32767!", iRareAttrValue); lua_pushboolean(L, false); return 1; } bool bRet = TRUE; int iRareAttrCount = item->GetRareAttrCount(); if (iRareAttrCount <= 1 && iRareAttrCount >= 0) { if (iRareAttrCount < iRareAttrIndex) iRareAttrIndex = iRareAttrCount; item->SetForceAttribute(iRareAttrIndex+5, iRareAttrType, iRareAttrValue); } else bRet = FALSE; lua_pushboolean(L, bRet); return 1; } int item_change_rare_attribute(lua_State* L) { LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item) return 0; if (item->GetType() == ITEM_COSTUME) { lua_pushboolean(L, false); return 1; } lua_pushboolean(L, item->ChangeRareAttribute()); return 1; } int item_equip_selected(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!lua_isnumber(L, 1)) { sys_err("Argument error."); lua_pushboolean(L, false); return 1; } int bCell = (int)lua_tonumber(L, 1); if (bCell < 0 || bCell >= WEAR_MAX_NUM) { sys_err("Invalid wear position %d. Index out of range(0..%d)", bCell, WEAR_MAX_NUM); lua_pushboolean(L, false); return 1; } LPITEM item = CQuestManager::instance().GetCurrentItem(); //current item in used LPITEM equipped = ch->GetWear(bCell); //current equipped item on target slot //check the pointers if (!ch || !item) return 0; //remove the equipped item if (equipped->GetVnum() != NULL || item->IsEquipped()) ch->UnequipItem(equipped); //equipping the item to the given slot item->EquipTo(ch, bCell); lua_pushboolean(L, true); return 1; } int item_set_count(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); LPITEM item = CQuestManager::instance().GetCurrentItem(); if (!item || !ch) { sys_err("No item selected or no character instance wtf?!"); return 0; } if (!lua_isnumber(L, 1)) { sys_err("Invalid argument."); return 0; } int count = (int)lua_tonumber(L, 1); if (count > g_iItemStackCount) { sys_err("Item count overflowing.. (%d)", count); return 0; } if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK) || !item->IsStackable()) return 0; if (count > 0) item->SetCount(count); else { item->RemoveFromCharacter(); M2_DESTROY_ITEM(item); //ITEM_MANAGER::instance().RemoveItem(item); } return 0; } { "get_flag", item_get_flag }, { "get_wearflag", item_get_wearflag }, { "get_antiflag", item_get_antiflag }, { "has_antiflag", item_has_antiflag }, { "get_refine_set", item_get_refine_set }, { "get_limit", item_get_limit }, { "get_apply", item_get_apply }, { "get_applies", item_get_applies, }, { "get_refine_materials", item_get_refine_materials }, { "get_addon_type", item_get_addon_type }, { "dec", item_dec }, { "inc", item_inc }, { "add_attribute", item_add_attribute }, { "get_attribute", item_get_attribute }, { "set_attribute", item_set_attribute }, { "change_attribute", item_change_attribute }, { "add_rare_attribute", item_add_rare_attribute }, { "get_rare_attribute", item_get_rare_attribute }, { "set_rare_attribute", item_set_rare_attribute }, { "change_rare_attribute", item_change_rare_attribute }, { "equip", item_equip_selected }, { "set_count", item_set_count }, questlua_npc.cpp #include "desc.h" // top of the file int npc_get_level(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetLevel()); return 1; } int npc_get_name(lua_State* L) { lua_pushstring(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetName()); return 1; } int npc_get_rank(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobRank()); return 1; } int npc_get_type(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobTable().bType); return 1; } int npc_is_metin(lua_State* L) { lua_pushboolean(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->IsStone()); return 1; } int npc_is_boss(lua_State* L) { lua_pushboolean(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobRank() == MOB_RANK_BOSS); return 1; } int npc_show_effect_on_target(lua_State* L) { CQuestManager& q = CQuestManager::instance(); LPCHARACTER ch = q.GetCurrentCharacterPtr(); LPCHARACTER tch = q.GetCurrentNPCCharacterPtr(); if (!tch || ch->GetVID() == tch->GetVID()) return 0; if (lua_isstring(L, 1)) tch->SpecificEffectPacket(lua_tostring(L, 2)); return 0; } int npc_get_ip(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); if (npc && npc->IsPC()) lua_pushstring(L, npc->GetDesc()->GetHostName()); else lua_pushstring(L, ""); return 1; } int npc_get_client_version(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); if (npc && npc->IsPC()) lua_pushstring(L, npc->GetDesc()->GetClientVersion()); else lua_pushstring(L, ""); return 1; } int npc_get_job(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); if (npc && npc->IsPC()) lua_pushnumber(L, npc->GetJob()); else lua_pushnumber(L, -1); return 1; } int npc_get_pid(lua_State* L) { LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr(); lua_pushnumber(L, npc->GetPlayerID()); return 1; } int npc_get_exp(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentNPCCharacterPtr()->GetMobTable().dwExp); return 1; } { "get_level", npc_get_level }, { "get_name", npc_get_name }, { "get_type", npc_get_type }, { "get_rank", npc_get_rank }, { "is_metin", npc_is_metin }, { "is_boss", npc_is_boss }, { "show_effect_on_target", npc_show_effect_on_target }, { "get_ip", npc_get_ip }, { "get_client_version", npc_get_client_version }, { "get_job", npc_get_job }, { "get_pid", npc_get_pid }, { "get_exp", npc_get_exp }, questlua_pc.cpp int pc_get_mount_vnum(lua_State * L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); lua_pushnumber(L, ch && ch->IsRiding() ? ch->GetMountVnum() : 0); return 1; } int pc_get_point(lua_State * L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!ch) { lua_pushnumber(L, 0); return 1; } if (!lua_isnumber(L, 1)) { sys_err("Argument error."); lua_pushnumber(L, 0); return 1; } int bPoint = (int)lua_tonumber(L, 1); if (bPoint < 0 || bPoint >= POINT_MAX_NUM) { sys_err("Invalid point (%d).", bPoint); lua_pushnumber(L, 0); return 1; } lua_pushnumber(L, ch->GetPoint(bPoint)); return 1; } int pc_get_real_point(lua_State * L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!ch) return 0; if (!lua_isnumber(L, 1)) { sys_err("Argument error."); lua_pushnumber(L, 0); return 1; } int bPoint = (int)lua_tonumber(L, 1); if (bPoint <= POINT_NONE || bPoint >= POINT_MAX_NUM) { sys_err("Invalid point (%d).", bPoint); lua_pushnumber(L, 0); return 1; } lua_pushnumber(L, ch->GetRealPoint(bPoint)); return 1; } int pc_specific_effect(lua_State * L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!ch) return 0; if (!lua_isstring(L, 1)) { sys_err("Argument error."); lua_pushboolean(L, false); return 1; } ch->SpecificEffectPacket(lua_tostring(L, 1)); lua_pushboolean(L, true); return 1; } int pc_disconnect_with_delay(lua_State * L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if (!ch) return 0; ch->GetDesc()->DelayedDisconnect(lua_isnumber(L, 1) ? (int)lua_tonumber(L, 1) : 10); return 0; } int pc_get_max_level(lua_State* L) { lua_pushnumber(L, gPlayerMaxLevel); return 1; } int pc_get_ip(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if(!ch) return 0; lua_pushstring(L, ch->GetDesc()->GetHostName()); return 1; } int pc_get_client_version(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if(!ch) return 0; lua_pushstring(L, ch->GetDesc()->GetClientVersion()); return 1; } int pc_kill(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if(!ch || ch->IsDead()) return 0; ch->EffectPacket(SE_CRITICAL); ch->PointChange(POINT_HP, -(ch->GetHP()+number(10, 255)), false); ch->Dead(); return 0; } { "get_mount_vnum", pc_get_mount_vnum }, { "get_point", pc_get_point }, { "get_real_point", pc_get_real_point }, { "show_effect", pc_specific_effect }, { "disconnect_with_delay", pc_disconnect_with_delay }, { "get_max_level", pc_get_max_level }, { "get_ip", pc_get_ip }, { "get_client_version", pc_get_client_version }, { "kill", pc_kill }, questlua_game.cpp Be carefull, in this code you can find a global config-variable! "g_iItemOwnershipTime" replace with 300 or what you want. int game_drop_item_and_select(lua_State* L) { /* Args: itemVnum | itemCount=1 | itemHasOwnership=false | itemOwnershipTime=gTime(180)*/ LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); LPITEM item = NULL; bool bHasOwnership; int iOwnershipTime; switch (lua_gettop(L)) { case 1: if (!lua_isnumber(L, 1)) { _ERROR: sys_err("Invalid arguments.."); return 0; } item = ITEM_MANAGER::instance().CreateItem((DWORD) lua_tonumber(L, 1)); break; case 2: case 3: case 4: if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) { goto _ERROR; } item = ITEM_MANAGER::instance().CreateItem((DWORD)lua_tonumber(L, 1), (int)lua_tonumber(L, 2)); bHasOwnership = lua_isboolean(L, 3) ? (bool)lua_toboolean(L, 3) : false; iOwnershipTime = lua_isnumber(L, 4) ? (int)lua_tonumber(L, 4) : g_iItemOwnershipTime;// g_iItemOwnershipTime:GLOBAL VARIABLE BY CONFIG.CPP break; default: goto _ERROR; } if (item == NULL) { sys_err("Cannot created item, error occurred."); return 0; } // SELECT_ITEM CQuestManager::Instance().SetCurrentItem(item); // END_OF_SELECT_ITEM if (bHasOwnership) item->SetOwnership(ch, iOwnershipTime); PIXEL_POSITION pos; pos.x = ch->GetX() + number(-100, 100); pos.y = ch->GetY() + number(-100, 100); item->AddToGround(ch->GetMapIndex(), pos); item->StartDestroyEvent(); return 0; } { "drop_item_and_select", game_drop_item_and_select }, questlua_pet.cpp int pet_is_mine(lua_State* L) { CQuestManager& q = CQuestManager::instance(); LPCHARACTER mch = q.GetCurrentCharacterPtr(); LPCHARACTER tch = q.GetCurrentNPCCharacterPtr(); CPetSystem* petSystem = mch->GetPetSystem(); CPetActor* petActor = petSystem->GetByVID(tch->GetVID()); lua_pushboolean(L, tch && tch->IsPet() && petActor && petActor->GetOwner() == mch); return 1; } { "is_mine", pet_is_mine }, questlua_global.cpp int _purge_vid(lua_State* L) { if (!lua_isnumber(L, 1)) { sys_err("_purge_vid: invalid vid"); return 0; } DWORD vid = (DWORD)lua_tonumber(L, 1); LPCHARACTER ch = CQuestManager::instance().GetCurrentNPCCharacterPtr(); LPCHARACTER npc = CHARACTER_MANAGER::instance().Find(vid); if ((true == npc->IsMonster() || true == npc->IsStone()) && !(npc->IsPet() || npc == ch)) M2_DESTROY_CHARACTER(npc); return 0; } { "purge_vid", _purge_vid }, 0x02.) Two GM commands: - "/kill_all" -> Kill all players inside your view-range/horizon - "/drop_item" -> Drop an item from arg1, or drop all items from range(arg1, arg2) Commands: // cmd.cpp ACMD(do_kill_all); ACMD(do_drop_item); { "kill_all", do_kill_all, 0, POS_DEAD, GM_HIGH_WIZARD }, { "drop_item", do_drop_item, 0, POS_DEAD, GM_HIGH_WIZARD }, // cmd_gm.cpp struct FuncKillAll { LPCHARACTER m_ch; FuncKillAll(LPCHARACTER ch): m_ch(ch) {} void operator()(LPENTITY ent) { if (ent->IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = (LPCHARACTER) ent; if (!ch->IsPC() || m_ch == ch || ch->IsGM() || ch->IsDead() || ch->GetHP() <= 0) return; float fDist = DISTANCE_APPROX(m_ch->GetX() - ch->GetX(), m_ch->GetY() - ch->GetY()); if (fDist > 7000.f) return; int damage = ch->GetHP()+number(1, 4250); ch->EffectPacket(SE_CRITICAL); ch->PointChange(POINT_HP, -damage, false); ch->Dead(); } } }; ACMD(do_kill_all) { LPSECTREE pSec = ch->GetSectree(); if (pSec) { FuncKillAll f(ch); pSec->ForEachAround(f); } } ACMD (do_drop_item) { //#Pass 1. With one arg: args[0] = Cell //#Pass 2. With two args: args[0] = BeginCell args[1] = EndCell char args[2][256]; argument = two_arguments(argument, args[0], 256, args[1], 256); if (!*args[0]) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: /drop_item <SlotPos> or"); ch->ChatPacket(CHAT_TYPE_INFO, " /drop_item <BeginPos> <EndPos>"); return; } if (!*args[1]) { int Cell; str_to_number(Cell, args[0]); if (Cell >= 0 && Cell < INVENTORY_MAX_NUM) ch->DropItem(TItemPos(INVENTORY, Cell)); else ch->ChatPacket(CHAT_TYPE_INFO, "Invalid argument! (Cell:%d)", Cell); } else { int beginPos; str_to_number(beginPos, args[0]); int endPos; str_to_number(endPos, args[1]); sys_log(0, "do_drop_item: beginPos: %d, endPos: %d", beginPos, endPos); if (beginPos >= 0 && endPos < INVENTORY_MAX_NUM && beginPos < endPos) { for(int Cell=beginPos; Cell<=endPos; Cell++) ch->DropItem(TItemPos(INVENTORY, Cell)); } else ch->ChatPacket(CHAT_TYPE_INFO, "Invalid arguments! (beginPos:%d; endPos:%d)", beginPos, endPos); } } Clientside version of kill_all: import chr,chrmgr try:import thread except ImportError:thread = None try:import localeInfo except ImportError:import locale as localeInfo ## ChatLine class ChatLine(ui.EditLine): ##[...] def __SendChatPacket(self, text, type): ##if text[0] == '/': ## if ENABLE_CHAT_COMMAND or constInfo.CONSOLE_ENABLE: ## pass ## else: ## return def KillAll(): c=0 try: getvid = chrmgr.GetVID#or kamer.GetVID#need import kamer ##Newer version, faster #kmr = app.GetInfo(app.INFO_ACTOR).split("Live ")[1].split(",")[0] s=app.GetInfo(app.INFO_ACTOR) ActorCount=int(s[s.find("Live ")+5:s.rfind(",")]) for i in xrange(ActorCount): vid=getvid(i) if(chr.INSTANCE_TYPE_PLAYER==chr.GetInstanceType(vid)): name=str(chr.GetNameByVID(vid)) if not name in ["None",player.GetName()]:net.SendChatPacket("/kill "+name,type);c+=1 except AttributeError: ##Prior version, slower for i in xrange(125000): if chr.INSTANCE_TYPE_PLAYER==chr.GetInstanceType(i): name=str(chr.GetNameByVID(i)) if not name in ["None",player.GetName()]:net.SendChatPacket("/kill "+name,type);c+=1 if(c>0):chat.AppendChat(chat.CHAT_TYPE_INFO,"You killed %d players."%( c )) try: tokens = text[1:].split() cmd = tokens.pop(0).lower() except: tokens = [] cmd = "" ## GM-Commands PlayerName = player.GetName() if text[0] == "/" and (PlayerName[0] == "[" and PlayerName[1] in ["S","G"]): if cmd == "killall":##"kill_all" is serverside if thread: thread.start_new_thread(KillAll,()) else: KillAll()## Client Freeze while done else: net.SendChatPacket(text, type) elif net.IsChatInsultIn(text): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING) else: net.SendChatPacket(text, type) 0x03.) refine_proto reloading without server restart. Extend your "/reload Proto" command with the refine_proto reloading with this code parts: - Open your db/src/ClientManager.cpp file and replace your "void CClientManager::QUERY_RELOAD_PROTO()" function to this: void CClientManager::QUERY_RELOAD_PROTO() { if (!InitializeTables()) { sys_err("QUERY_RELOAD_PROTO: cannot load tables"); return; } for (TPeerList::iterator i = m_peerList.begin(); i != m_peerList.end(); ++i) { CPeer * tmp = *i; if (!tmp->GetChannel()) continue; tmp->EncodeHeader(HEADER_DG_RELOAD_PROTO, 0, sizeof(WORD) + sizeof(TSkillTable) * m_vec_skillTable.size() + sizeof(WORD) + sizeof(TBanwordTable) * m_vec_banwordTable.size() + sizeof(WORD) + sizeof(TItemTable) * m_vec_itemTable.size() + sizeof(WORD) + sizeof(TMobTable) * m_vec_mobTable.size() + sizeof(WORD) + sizeof(TRefineTable) * m_iRefineTableSize); tmp->EncodeWORD(m_vec_skillTable.size()); tmp->Encode(&m_vec_skillTable[0], sizeof(TSkillTable) * m_vec_skillTable.size()); tmp->EncodeWORD(m_vec_banwordTable.size()); tmp->Encode(&m_vec_banwordTable[0], sizeof(TBanwordTable) * m_vec_banwordTable.size()); tmp->EncodeWORD(m_vec_itemTable.size()); tmp->Encode(&m_vec_itemTable[0], sizeof(TItemTable) * m_vec_itemTable.size()); tmp->EncodeWORD(m_vec_mobTable.size()); tmp->Encode(&m_vec_mobTable[0], sizeof(TMobTable) * m_vec_mobTable.size()); tmp->EncodeWORD(m_iRefineTableSize); tmp->Encode(m_pRefineTable, sizeof(TRefineTable) * m_iRefineTableSize); } } - Then open game/src/refine.cpp and replace this function: "bool CRefineManager::Initialize(TRefineTable * table, int size)" to this: bool CRefineManager::Initialize(TRefineTable * table, int size) { if (!m_map_RefineRecipe.empty()) m_map_RefineRecipe.clear(); for (int i = 0; i < size; ++i, ++table) { sys_log(0, "REFINE %d prob %d cost %d", table->id, table->prob, table->cost); m_map_RefineRecipe.insert(std::make_pair(table->id, *table)); } sys_log(0, "REFINE: COUNT %d", m_map_RefineRecipe.size()); return true; } - If you are done with these, open game/src/input_db.cpp and extend this event "void CInputDB::ReloadProto(const char * c_pData)" with this: /* * REFINE */ wSize = decode_2bytes(c_pData); c_pData += 2; sys_log(0, "RELOAD: REFINE: %d", wSize); if (wSize) { CRefineManager::instance().Initialize((TRefineTable *) c_pData, wSize); c_pData += wSize * sizeof(TRefineTable); } - Done. 0x04.) kill quest trigger fix (when kill / when race.kill) With this change you can use every kill methods with mobs and players and runs by once per kills. Examples: when 101.kill begin -> Works when you are killing Wild dogs. when kill begin -> Works with mobs and players too. when kill with npc.is_pc() begin -> Works with players only. when kill with npc.is_pc() == false begin -> Works with monsters only. when kill with npc.get_race() == 102 begin -> Works when you hunt Wolf. I tested with these codes: when kill begin if npc.is_pc() then chat("kill pc") end if npc.get_race() > 100 then chat("kill by race: "..tostring(npc.race)) end end when kill with npc.is_pc() begin chat("kill with npc.is_pc") end when kill with npc.get_race() == 102 begin chat("kill with npc.get_race 102") end when 101.kill begin chat("101.kill") end Follow these steps to fix it: - Open game/src/questmanager.h and search for this: "void Kill(unsigned int pc, unsigned int npc);" replace to: "void Kill(unsigned int pc, unsigned int npc, unsigned int pc2 = 0);" - Save&Close, open game/src/questmanager.cpp and search this function: "void CQuestManager::Kill(unsigned int pc, unsigned int npc)" - and replace to this: void CQuestManager::Kill(unsigned int pc, unsigned int npc, unsigned int pc2) { //m_CurrentNPCRace = npc; PC * pPC; sys_log(0, "CQuestManager::Kill QUEST_KILL_EVENT (pc=%d, npc=%d, pc2=%d)", pc, npc, pc2); if ((pPC = GetPC(pc))) { if (!CheckQuestLoaded(pPC)) return; /* [hyo] ¸÷ kill˝Ă Áßşą Ä«żîĆĂ ŔĚ˝´ °ü·ĂÇŃ ĽöÁ¤»çÇ× quest scriptżˇ when 171.kill begin ... µîŔÇ ÄÚµĺ·Î ŔÎÇĎż© ˝şĹ©¸łĆ®°ˇ Ăł¸®µÇľú´ő¶óµµ ąŮ·Î returnÇĎÁö ľĘ°í ´Ů¸Ą °Ë»çµµ ĽöÇŕÇϵµ·Ď şŻ°ćÇÔ. (2011/07/21) */ // call script if (npc > 0 && pc2 == 0) m_mapNPC[npc].OnKill(*pPC); LPCHARACTER ch = GetCurrentCharacterPtr(); LPPARTY pParty = ch->GetParty(); LPCHARACTER leader = pParty ? pParty->GetLeaderCharacter() : ch; if (leader) { m_pCurrentPartyMember = ch; if (m_mapNPC[npc].OnPartyKill(*GetPC(leader->GetPlayerID()))) return; pPC = GetPC(pc); } LPCHARACTER victim = CHARACTER_MANAGER::instance().FindByPID(pc2); if (victim && victim->IsPC() && m_mapNPC[QUEST_NO_NPC].OnKill(*pPC)) return; else if (m_mapNPC[QUEST_NO_NPC].OnKill(*pPC)) return; if (leader) { m_pCurrentPartyMember = ch; m_mapNPC[QUEST_NO_NPC].OnPartyKill(*GetPC(leader->GetPlayerID())); } } else sys_err("QUEST: no such pc id : %d", pc); } - Save&Close, open game/src/char_battle.cpp and search this call: "quest::CQuestManager::instance().Kill(pkKiller->GetPlayerID(), quest::QUEST_NO_NPC)" - and replace to this: "quest::CQuestManager::instance().Kill(pkKiller->GetPlayerID(), quest::QUEST_NO_NPC, GetPlayerID());" - Done. 0x05.) ImmuneBug fix. I know there are some fixes but this is a working solution.. Everything inside two functions into item.cpp file by names: "CItem::EquipTo" and "CItem::Unequip". Every two functions are containing this sh*!&t: DWORD dwImmuneFlag = 0; for (int i = 0; i < WEAR_MAX_NUM; ++i) if (m_pOwner->GetWear(i)) SET_BIT(dwImmuneFlag, m_pOwner->GetWear(i)->m_pProto->dwImmuneFlag); m_pOwner->SetImmuneFlag(dwImmuneFlag); Hm, you have to replace those to this: DWORD dwImmuneFlag = 0; LPITEM item = NULL; for (int i = 0; i < WEAR_MAX_NUM; ++i) { if (item=m_pOwner->GetWear(i)) { if (item->GetImmuneFlag() != 0) SET_BIT(dwImmuneFlag, item->GetImmuneFlag()); if (item->GetAttributeCount() > 0) { if (item->HasAttr(APPLY_IMMUNE_STUN)) SET_BIT(dwImmuneFlag, IMMUNE_STUN); if (item->HasAttr(APPLY_IMMUNE_SLOW)) SET_BIT(dwImmuneFlag, IMMUNE_SLOW); if (item->HasAttr(APPLY_IMMUNE_FALL)) SET_BIT(dwImmuneFlag, IMMUNE_FALL); } } } m_pOwner->SetImmuneFlag(dwImmuneFlag); - Done. 0x06.) Finished uiQuest.py selection by keyboard-usage with "Next" and "Prev" buttons. Test-example: when 9010.chat."TEST selection pages" begin local sTab = { "01","02","03","04","05","06","07","08","09","10", "11","12","13","14","15","16","17","18","19","20", "Exit"--to make exit by Escape key } local s=select_table(sTab) if s==table.getn(sTab) then return end chat("You'r choice: sTab["..tostring(s).."] -> "..sTab[s]) end Here you can download the full uiquest.py file from my client: Download 0x07.) Little SQL-Script: SELECT log.log.time AS "When", player.player.`name` AS Who, log.log.how AS WhatDid, log.log.what AS ItemID, log.log.vnum AS ItemVnum, player.item_proto.locale_name AS ItemName, player.item.count AS Count, player.item.Socket0, player.item.Socket1, player.item.Socket2, player.item.AttrType0, player.item.AttrValue0, player.item.AttrType1, player.item.AttrValue1, player.item.AttrType2, player.item.AttrValue2, player.item.AttrType3, player.item.AttrValue3, player.item.AttrType4, player.item.AttrValue4, player.item.AttrType5, player.item.AttrValue5, player.item.AttrType6, player.item.AttrValue6 FROM log.log INNER JOIN player.player ON log.log.who = player.player.id INNER JOIN player.item ON log.log.what = player.item.id INNER JOIN player.item_proto ON log.log.vnum = player.item_proto.vnum WHERE log.how in ("EXCHANGE_GIVE", "EXCHANGE_TAKE", "DROP", "SAFEBOX PUT", "SAFEBOX GET", "DEAD_DROP") AND player.`name` = "Xeriesey"; * You have to give a name where you can see Xeriesey ^-^ Result of query: I hope you like it. If you have any questions or find an error/mistake, just post a message into this thread and I will try to make answer when I'll be online. ps.: Sorry for my bad English. "(" + "c" + ")" == © -> F**k Changelog: - 2014.09.22. 16:29 / 04:29 PM ~ Added forgotten include to questlua_npc.cpp. - 2014.09.22. 16:48 / 04:48 PM ~ Added more forgotten things :S - 2014.09.27. 13:08 / 01:08 PM ~ SQL syntax fix With Regards, P3NG3R which cpp questlua_item.cpp config ??? iemstacocount .cpp? 2 Link to comment Share on other sites More sharing options...
Former Staff Shisui 492 Posted April 1, 2015 Former Staff Share Posted April 1, 2015 I hate when I do something wrong. Could you guys please tell me whats wrong? In file included from questlua_item.cpp:5: item.h: In member function 'BYTE CItem::GetSize()': item.h:45: error: 'const struct SItemTable' has no member named 'bSize' item.h: In member function 'DWORD CItem::GetWearFlag()': item.h:53: error: 'const struct SItemTable' has no member named 'dwWearFlags' item.h: In member function 'DWORD CItem::GetAntiFlag()': item.h:54: error: 'const struct SItemTable' has no member named 'dwAntiFlags' item.h: In member function 'DWORD CItem::GetImmuneFlag()': item.h:55: error: 'const struct SItemTable' has no member named 'dwImmuneFlag' item.h: In member function 'BYTE CItem::GetType() const': item.h:70: error: 'const struct SItemTable' has no member named 'bType' item.h: In member function 'BYTE CItem::GetSubType() const': item.h:71: error: 'const struct SItemTable' has no member named 'bSubType' item.h: In member function 'BYTE CItem::GetLimitType(DWORD) const': item.h:72: error: 'const struct TItemLimit' has no member named 'bType' item.h: In member function 'BYTE CItem::GetAttributeType(int)': item.h:121: error: 'struct TPlayerItemAttribute' has no member named 'bType' item.h: In member function 'DWORD CItem::GetRefinedVnum()': item.h:136: error: 'const struct SItemTable' has no member named 'dwRefinedVnum' item.h: In member function 'WORD CItem::GetRefineSet()': item.h:153: error: 'const struct SItemTable' has no member named 'wRefineSet' ../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP:: NameValuePairs::GetValue(const char*, T&) const [with T = std::string]': ../../../Extern/include/cryptopp/cryptlib.h:277: instantiated from here ../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-pun ned pointer will break strict-aliasing rules ../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP:: NameValuePairs::GetValue(const char*, T&) const [with T = int]': ../../../Extern/include/cryptopp/cryptlib.h:283: instantiated from here ../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-pun ned pointer will break strict-aliasing rules Makefile:119: recipe for target 'OBJDIR/questlua_npc.o' failed gmake: *** [OBJDIR/questlua_npc.o] Error 1 gmake: *** Waiting for unfinished jobs.... ../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP:: NameValuePairs::GetValue(const char*, T&) const [with T = std::string]': ../../../Extern/include/cryptopp/cryptlib.h:277: instantiated from here ../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-pun ned pointer will break strict-aliasing rules ../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP:: NameValuePairs::GetValue(const char*, T&) const [with T = int]': ../../../Extern/include/cryptopp/cryptlib.h:283: instantiated from here ../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-pun ned pointer will break strict-aliasing rules ../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP:: NameValuePairs::GetValue(const char*, T&) const [with T = std::string]': ../../../Extern/include/cryptopp/cryptlib.h:277: instantiated from here ../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-pun ned pointer will break strict-aliasing rules ../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP:: NameValuePairs::GetValue(const char*, T&) const [with T = int]': ../../../Extern/include/cryptopp/cryptlib.h:283: instantiated from here ../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-pun ned pointer will break strict-aliasing rules questlua_item.cpp: In function 'int quest::item_next_refine_vnum(lua_State*)': questlua_item.cpp:322: error: 'struct SItemTable' has no member named 'dwRefined Vnum' questlua_item.cpp: In function 'int quest::item_copy_and_give_before_remove(lua_ State*)': questlua_item.cpp:444: error: no matching function for call to 'SItemPos::SItemP os(EWindows, BYTE&)' ../../common/length.h:713: note: candidates are: SItemPos::SItemPos() ../../common/length.h:710: note: SItemPos::SItemPos(const SItemP os&) questlua_item.cpp: In function 'int quest::item_get_apply(lua_State*)': questlua_item.cpp:565: error: 'const struct TItemLimit' has no member named 'bTy pe' questlua_item.cpp: In function 'int quest::item_get_applies(lua_State*)': questlua_item.cpp:591: error: 'const struct TItemLimit' has no member named 'bTy pe' questlua_item.cpp:588: warning: unused variable 'Key1' questlua_item.cpp:588: warning: unused variable 'Key2' questlua_item.cpp: In function 'int quest::item_get_refine_materials(lua_State*) ': questlua_item.cpp:612: error: incomplete type 'CRefineManager' used in nested na me specifier questlua_item.cpp:619: error: 'const struct SRefineTable' has no member named 'm aterial_count' questlua_item.cpp:632: error: 'const struct SRefineTable' has no member named 'm aterial_count' questlua_item.cpp:638: error: 'const struct SRefineTable' has no member named 'm aterial_count' questlua_item.cpp:641: error: 'const struct TRefineMaterial' has no member named 'vnum' questlua_item.cpp: In function 'int quest::item_get_attribute(lua_State*)': questlua_item.cpp:752: error: 'const struct TPlayerItemAttribute' has no member named 'bType' questlua_item.cpp: In function 'int quest::item_set_attribute(lua_State*)': questlua_item.cpp:806: error: 'const struct TPlayerItemAttribute' has no member named 'bType' questlua_item.cpp: In function 'int quest::item_get_rare_attribute(lua_State*)': questlua_item.cpp:903: error: 'const struct TPlayerItemAttribute' has no member named 'bType' questlua_item.cpp: In function 'int quest::item_set_rare_attribute(lua_State*)': questlua_item.cpp:958: error: 'const struct TPlayerItemAttribute' has no member named 'bType' questlua_item.cpp: In function 'int quest::item_equip_selected(lua_State*)': questlua_item.cpp:1031: warning: NULL used in arithmetic Makefile:119: recipe for target 'OBJDIR/questlua_item.o' failed gmake: *** [OBJDIR/questlua_item.o] Error 1 Link to comment Share on other sites More sharing options...
Recommended Posts