Jump to content
Metin2 Network
Create New...

xpro

Administrator
  • Posts

    271
  • Joined

  • Last visited

  • Days Won

    259

Everything posted by xpro

  1. Download: [Hidden Content]
  2. ACMD(do_item_new) // Nowa funkcja by: Muchomor { char arg1[256], arg2[256], arg3[256]; three_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2), arg3, sizeof(arg3)); if (!*arg1) { ch->ChatPacket(CHAT_TYPE_INFO, "Usage: item <item vnum> <item count> <times to spawn>"); return; } int iCount = 1; int iTimes = 1; if (*arg2) { str_to_number(iCount, arg2); iCount = MINMAX(1, iCount, g_bItemCountLimit); } if (*arg3) { str_to_number(iTimes, arg3); iTimes = MAX(1, iTimes); } DWORD dwVnum; std::pair<DWORD, DWORD> vnumRange; std::vector<std::string> v_range; std::string sRange(arg1); boost::split(v_range, sRange, boost::is_any_of("-")); if (v_range.size() < 2) { if (isnhdigit(*arg1)) { str_to_number(dwVnum, arg1); if (!ITEM_MANAGER::instance().GetTable_NEW(dwVnum)) { ch->ChatPacket(CHAT_TYPE_INFO, "#%u item does not exist by that vnum.", dwVnum); return; } else { vnumRange = std::make_pair(dwVnum, dwVnum); } } else { if (!ITEM_MANAGER::instance().GetVnum(arg1, dwVnum)) { ch->ChatPacket(CHAT_TYPE_INFO, "#%u item does not exist by that vnum(%s).", dwVnum, arg1); return; } else { vnumRange = std::make_pair(dwVnum, dwVnum); } } } else { try { vnumRange = std::make_pair(std::stoul(v_range[0], NULL, 10), std::stoul(v_range[1], NULL, 10)); if (vnumRange.first > vnumRange.second) { std::swap(vnumRange.first, vnumRange.second); } } catch (...) { ch->ChatPacket(CHAT_TYPE_INFO, "Invalid range! To use range feature type following syntax: ID-ID."); return; } } for (unsigned int i = vnumRange.first; i <= vnumRange.second; i++) { for (int j = 0; j < iTimes; j++) { LPITEM item = ITEM_MANAGER::instance().CreateItem(i, 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 does not exist by that vnum.", dwVnum); } } } }
  3. Others people want 2k pln for it packer, funny. Just find #define ENABLE_LZ4_PACK_COMPRESSION Download: [Hidden Content]
  4. uitooltip.py Find: def AddItemData(self Add before def ObrazPrzedmiotu(self, file): iconFile = str(file) itemImage = ui.ImageBox() itemImage.SetParent(self) itemImage.Show() itemImage.LoadImage(iconFile) itemImage.SetPosition(itemImage.GetWidth()/ 2 - 5+82, self.toolTipHeight) self.toolTipHeight += itemImage.GetHeight() self.childrenList.append(itemImage) self.ResizeToolTip() in this line we edit the X position of the image itemImage.SetPosition(itemImage.GetWidth()/ 2 - 5+82, self.toolTipHeight) Exemple: if 43101 == itemVnum: if 0 != metinSlot: self.ObrazPrzedmiotu("icon/item/43001.tga")
  5. Download: [Hidden Content]
  6. pc.get_account() : Returns String value. Returns the account name. pc.get_account_id() : Returns an int value. Returns the account id. pc.get_alignment() : Returns an int value. Returns the rank of the character. pc.get_dx() : Returns an int value. Gives the character's dex score. pc.get_empire() : Returns an int value. Returns the character's kingdom. (1: Red, 2: Yellow, 3: Blue) pc.get_empty_inventory_count() : Returns an int value. Returns the number of empty slots in the character's inventory. pc.get_equip_refine_level( LuaNumber cell ) : Takes 1 argument. It is int value. When you send the slot id in the inventory, it gives the refinement level of the item in that slot, that is, the + value. pc.get_exp() : Returns an int value. Returns the character's EXP information. pc.get_exp_level() : Returns an int value. Returns the character's EXP box information. It returns as many numbers as how many boxes are full. pc.get_gm_level() : Returns an int value. Grants the character's GM authority. (1: Player, 2: LOW_WIZARD, 3: GOD, 4: HIGH_WIZARD, 5: IMPLEMENTOR) pc.get_gold() : Returns an int value. Returns the character's Yang amount. pc.get_guild() : Returns an int value. Returns the id of the character's guild. Returns false if there is no guild. pc.get_horse_level() : Returns an int value. Gives the character horse level. Returns false if there is no horse. pc.get_hp() : Returns an int value. Gives the character's current life points. pc.get_ht() : Returns an int value. Gives the character's VIT score. pc.get_informer_item() pc.get_informer_type() pc.get_ip0() : Returns String value. Returns the character's ip information. pc.get_iq() : Returns an int value. Returns the character's INT score. pc.get_job() : Returns an int value. Returns the gender of the character. pc.get_killee_drop_pct() pc.get_language() pc.get_leadership() pc.get_language2() pc.get_level() : Returns an int value. Returns the character's level. pc.get_local_x() : Returns an int value. Returns the x value of the client-based character's position. pc.get_local_y() : Returns an int value. Returns the y value of the client-based character's position. pc.get_logoff_interval() pc.get_map_index() : Returns an int value. Returns the id of the map where the character is located. pc.get_max_hp() : Returns an int value. It gives the maximum hp the character can get. pc.get_max_sp() : Returns an int value. It gives the maximum sp points that the character can get. pc.get_money() : Returns an int value. Returns the character's Yang amount. pc.get_name() : Returns String value. Gives the name of the character. pc.get_next_exp() : Returns an int value. Gives the amount of EXP required for the next level. pc.get_part() pc.get_player_id() : Returns an int value. Returns the id of the character. pc.get_playtime() : Returns an int value. Returns the total time spent in the game. pc.get_premium_remain_sec() : Returns an int value. Grants the premium time. pc.get_race() : Returns an int value. Returns the class of the character. pc.get_real_alignment() : Returns an int value. Returns the character's ranking score. pc.get_sex() : Returns an int value. Returns the gender of the character. pc.get_sig_items(LuaNumber group_vnum) : Takes an Int argument. Returns an array. Returns the item list of the item group sent with the argument. pc.get_skill_group() : Returns an int value. Gives the character's chosen ability group. Ex: Bodily, Mental pc.get_skill_level(LuaNumber vnum) : Takes 1 argument. Returns an int. Returns the level of the skill id sent with the argument. Ex: pc.get_skill_level(31) => Returns the level of the Assassination skill. pc.get_skill_point() : Returns an int value. It gives the amount of skill points that the character has not used. pc.get_sockets_item() : Returns an array. It lists the socket information of the items in the character's inventory. pc.get_sp() : Returns an int value. Returns the character's HP. pc.get_special_ride_vnum() : Returns an int value. Returns special item information. pc.get_st() : Returns an int value. Gives the character's STR score. pc.get_start_location() pc.get_vid() : Returns an int value. Returns the auth id of the character. pc.get_war_map() pc.get_weapon() : Returns an int value. Returns the vnum value of the weapon the character is wearing in their hand. Returns false if empty-handed. pc.get_wear( LuaNumber cell ) : Takes 1 int argument. Returns an int value. It gives the wear flag of the item in the box in the inventory determined by the data sent with the argument. pc.get_x() : Returns an int value. Returns the x-coordinate of the server-based character. pc.get_y() : Returns an int value. Returns the y-coordinate of the server-based character. pc.getarmor() : Returns an int value. Gives the vnum of the armor that the character wears on it. If not, it returns false. pc.getcheque() : Returns an int value. Returns the character's Won information. pc.getcurrentmapindex() : Returns an int value. Returns the id of the map where the character is located. pc.getempire() : Returns an int value. Returns the character's kingdom. (1: Red, 2: Yellow, 3: Blue) pc.getf( LuaString questname, LuaString flagname ) : It takes 2 string arguments. 1st quest name, 2nd flag name. Returns an int value. quest returns the value added to the database. pc.getgold() : Returns an int value. Returns the character's Yang amount. pc.getguild() : Returns an int value. Returns the id of the character's guild. Returns false if there is no guild. pc.gethp() : Returns an int value. Gives the character's current life points. pc.getleadership() pc.getmaxhp() : Returns an int value. It gives the maximum hp the character can get. pc.getmaxsp() : Returns an int value. It gives the maximum sp points the character can get. pc.money() : Returns an int value. Returns the character's Yang amount. pc.getplaytime() : Returns an int value. Returns the total time spent in the game. pc.getqf( LuaString flag ) : Takes 1 string argument. Returns an int. It searches the flag value of the running quest in the quest database and returns its value. pc.getsp() : Returns an int value. Gives the character's current mana points. pc.getweapon() : Returns an int value. Returns the vnum value of the weapon the character is wearing in their hand. Returns false if empty-handed. pc.getx() : Returns an int value. Returns the x-coordinate of the server-based character. pc.gety() : Returns an int value. Returns the y-coordinate of the server-based character. Item Functions item.can_over9refine() : Checks if the item has a transformation after +9. Returns Boolean. (If: 1, Otherwise: 0) item.change_to_over9() : Changes the transformation of the item. item.copy_and_give_before_remove( LuaNumber vnum ) : Gives you an item with the vnum we gave in the argument and deletes the item. item.get_addon_type() : Returns the addon_type value if the item can take average and skill damage. item.get_attribute_set_index() item.get_cell( LuaNumber cell ) : Gets the information of the item in your inventory. item.get_count() : Returns the number of items. as int. item.get_id() : The id of the item. as int. item.get_level() : Returns the + value of the item. as int. item.get_level_limit() : Gets the level limit of the item. item.get_name() : Returns the locale name of the item. item.get_over9_material_vnum( LuaNumber vnum ) : Returns the transformation materials of the item transformed after +9. item.get_refine_vnum( LuaNumber vnum ) : Gets the refinement (development) vnum of the item. item.get_shop_price() : The selling price of the item in the NPC. item.get_size() : It gives information about how many slots the item occupies in the inventory. item.get_socket( LuaNumber index ) : Returns the stones engraved on the item or the duration of the item. item.get_sub_type() : Returns the subtype of the item. item.get_type() : Returns the main type of the item. item.get_value( LuaNumber index ) : Returns the value of the item. item.get_vnum() : Returns the item's item_proto id. item.has_flag( LuaNumber value ) : Checks whether the value given in the argument is in the item. item.next_refine_vnum() : Returns the refine vnum at the next + enhancement. item.over9refine() : Checks if the item has a transformation after +9. Returns Boolean. (If: 1, Otherwise: 0) item.remove() : Deletes the item. item.select( LuaNumber item_id ) : Selects the item with the item's id. (For use in quests.) item.select_cell( LuaNumber cell ) : Selects the item with its cell number in the inventory. (For use in quests.) item.set_shop_price() : To change the npc sold value of the item. item.set_socket( LuaNumber index, LuaNumber value ) : Changes the socket value of the item. item.set_value( LuaNumber index, LuaNumber value ) : Changes the value of the item. item.start_realtime_expire() : If the item has an expiration date, it starts its duration. item.get_wearflag0() : Returns the type of item. item.has_wearflag0( luaNumber index ) : It checks whether the data sent with the argument matches the wearflag of the item. item.get_antiflag0( luaNumber index ) : It checks whether the data sent with the argument matches the antiflag of the item. item.has_antiflag0() : Returns the item's antiflag (shaman cannot wear etc.) information. item.get_immuneflag0() : Returns the item's immuneflag value. item.has_immuneflag0( luaNumber index ) : The data sent with the argument checks whether the item matches the immuneflag. item.add_attr0( LuaNumber mode ) : It is used to add enchantment to the item. item.change_attr0( LuaNumber mod e) : Changes the item's enchantments. item.clear_attr0( LuaNumber mode ) : Clears the item's enchantments item.count_attr0( LuaNumber mode ) : Changes the value of the item's enchantments. item.get_attr0() : Returns the item's enchantments. item.set_attr0( LuaNumber id1, LuaNumber value1, LuaNumber id2, LuaNumber value2, LuaNumber id3, LuaNumber value3, LuaNumber id4, LuaNumber value4, LuaNumber id5, LuaNumber id2, LuaNumber value7 of LuaNumber value7, LuaNumber value6 of LuaNumber id5, LuaNumber value7, LuaNumber value6 It's good to enter alone. item.set_count0( LuaNumber count ) : Changes the quantity of the item. item.is_available0() : The item used.
  7. locale_game.txt Add TOOLTIP_BUYPRICE_FREE Item is free. uitooltip.py Find: def AppendPrice(self, price): Change def AppendPrice(self, price): self.AppendSpace(5) if price == 0: self.AppendTextLine(localeInfo.TOOLTIP_BUYPRICE_FREE, self.POSITIVE_COLOR) else: self.AppendTextLine(localeInfo.TOOLTIP_BUYPRICE % (localeInfo.NumberToMoneyString(price)), self.GetPriceColor(price))
  8. I shared this because as a player it is difficult to call it up, and I found when I was playing around with copying items. Find Item_manager.cpp void ITEM_MANAGER::RemoveItem(LPITEM item, const char * c_pszReason) { if (!item) // Fix game.core return; and #ifndef DEBUG_ALLOC void ITEM_MANAGER::DestroyItem(LPITEM item) #else void ITEM_MANAGER::DestroyItem(LPITEM item, const char* file, size_t line) #endif { if (!item) // Fix game.core { sys_err("co jest kurwa."); return; } and void ITEM_MANAGER::GetPlayerItem(LPITEM item, TPlayerItem* result) { if (!item) return;
  9. INTRODUCTION & PROBLEM Hello, we will solve the famous "Cannot Find Tree" problem in the "CHARACTER::Sync" function in the server src and also the problems that may be caused by the "Dead();" section used for everything that is not a PC in this function. WHAT DID WE CHANGE? All of the currently shared fixes are actually incomplete, we will make a new arrangement to solve this problem at its root, thus we will fix the problem completely. HOW TO DO? Without going into details such as editing the reward mechanism of the existing dead function, we will simply create a new dead function and use it in Sync. The main purpose of this function, which can only be used for mobs and metins, is that it does not give a reward (drop) after the dead function, let's get started. First, open "char_battle.cpp" // FIND; struct FuncSetLastAttacked // Add ABOVE; void CHARACTER::RewardlessDead() // DevFix 29 { if (IsPC()) // This function only for mobs or stones, so if IsPC() exit the function before it start. - [MT2Dev Note] - 10/10/2024 { return; } if (IsDead()) { return; } if (IsMonster() || IsStone()) // Dead is only possible when victim is mob or stone. - [MT2Dev Note] - 10/10/2024 { SetPosition (POS_DEAD); ClearAffect (true); ClearSync(); Reward (false); // No drop yang or item. - [MT2Dev Note] if (m_pkStunEvent) { event_cancel (&m_pkStunEvent); } TPacketGCDead pack; pack.header = HEADER_GC_DEAD; pack.vid = m_vid; PacketAround (&pack, sizeof (pack)); REMOVE_BIT (m_pointsInstant.instant_flag, INSTANT_FLAG_STUN); sys_log (0, "Rewardless_DEAD: %s %p", GetName(), this); // Create Dead event.. In the Dead event, for monsters, make them destroy after a few seconds. - [Ymir Dev Note] if (m_pkDeadEvent) { event_cancel (&m_pkDeadEvent); } if (IsStone()) { ClearStone(); } if (GetDungeon()) { GetDungeon()->DeadCharacter (this); } SCharDeadEventInfo* pEventInfo = AllocEventInfo<SCharDeadEventInfo>(); pEventInfo->isPC = false; pEventInfo->dwID = this->GetVID(); m_pkDeadEvent = event_create (dead_event, pEventInfo, PASSES_PER_SEC (0)); sys_log (0, "Rewardless_DEAD_EVENT_CREATE: %s %p %p", GetName(), this, get_pointer (m_pkDeadEvent)); } } Then open "char.cpp" // Find the function; bool CHARACTER::Sync (long x, long y) { //xxx } // Change it completely; // DevFix 29 - Necessary arrangement for scenarios where sync is not possible. - [MT2Dev Note] - 01/04/2024 // Moves to the specified x, y position regardless. - [Ymir Dev Note] bool CHARACTER::Sync (long x, long y) { LPSECTREE current_tree = GetSectree(); // For a better performance, call it only once.. - [MT2Dev Note] if (!current_tree) { sys_err ("<CHARACTER::Sync> Sectree is NULL! - Name: %s", GetName()); return false; } if (IsPC() && IsDead()) // DevFix 27 - Dead players not needed sync.. - [MT2Dev Note] - 01/04/2024 { return false; } LPSECTREE new_tree = SECTREE_MANAGER::instance().Get (GetMapIndex(), x, y); if (!new_tree) { if (GetDesc()) { sys_err ("Cannot Find Tree at - X: %d Y: %d (Name: %s)", x, y, GetName()); x = GetX(); y = GetY(); new_tree = current_tree; // If there is no new tree, just use the old one. - [MT2Dev Note] if (!new_tree) { sys_err ("[CRITICAL] - Cannot Find Tree at - X: %d Y: %d (Name: %s)", x, y, GetName()); GetDesc()->SetPhase (PHASE_CLOSE); } } else { if (IsMonster() || IsStone()) // Dead is only possible when victim is mob or stone. - [MT2Dev Note] - 10/10/2024 { sys_err ("[MOB or STONE]No Tree: %d %d %d", x, y, GetMapIndex()); RewardlessDead(); // In this special case, we don't want any reward so this is new function for it. - [MT2Dev Note] - 10/10/2024 } else { sys_err ("[HOW IS THIS POSSIBLE?]No Tree: %d %d %d", x, y, GetMapIndex()); } } return false; } SetRotationToXY (x, y); SetXYZ (x, y, 0); if (GetDungeon()) { // Dungeon event attribute change. - [Ymir Dev Note] int iLastEventAttr = m_iEventAttr; m_iEventAttr = new_tree->GetEventAttribute (x, y); if (m_iEventAttr != iLastEventAttr) { if (GetParty()) { quest::CQuestManager::instance().AttrOut (GetParty()->GetLeaderPID(), this, iLastEventAttr); quest::CQuestManager::instance().AttrIn (GetParty()->GetLeaderPID(), this, m_iEventAttr); } else { quest::CQuestManager::instance().AttrOut (GetPlayerID(), this, iLastEventAttr); quest::CQuestManager::instance().AttrIn (GetPlayerID(), this, m_iEventAttr); } } } if (current_tree != new_tree) { if (!IsNPC()) { SECTREEID id = new_tree->GetID(); SECTREEID old_id = current_tree->GetID(); const float fDist = DISTANCE_SQRT (id.coord.x - old_id.coord.x, id.coord.y - old_id.coord.y); sys_log (0, "SECTREE DIFFER: %s %dx%d was %dx%d dist %.1fm", GetName(), id.coord.x, id.coord.y, old_id.coord.x, old_id.coord.y, fDist); // DevFix 30 } new_tree->InsertEntity (this); } return true; } Lastly, open "char.h" // Find; void Dead (LPCHARACTER pkKiller = NULL, bool bImmediateDead = false); // Add under; void RewardlessDead(); // DevFix 29
  10. Download: [Hidden Content]
  11. Hello Yohara, the maps were shared empty, I tried to remove them one by one from a shared file, I wanted to share them on the forum, maybe it will be useful for someone, if the maps are not attached, there may be a problem, this is an update only for attached maps. Download: [Hidden Content]
×
×
  • Create New...

Important Information

Terms of Service

Write what you are looking for and press enter or click the search icon to begin your search