Jump to content

wezt

Inactive Member
  • Posts

    97
  • Joined

  • Last visited

  • Days Won

    4
  • Feedback

    0%

Posts posted by wezt

  1. Hi devs!

    I'd like to ask if someone has experience in using IDE's for server source development (freebsd source, development on windows machine)?
    Would be nice if you'll share some info about this question, which software you're using, cons/pros of some IDE's, examples of your development enviroment and all other related info.

    At the moment I'm going to try CLion on virtualbox with freebsd. Probably you have better solutions.

    Thanks in advance :) 

    • Love 1
  2. @DeYaN. you need to create 'locale' folder in your game client directory.

    Spoiler

    dVIncUW.png

     

    Then, move all dds/png/tga files from your locale pack in this folder. File paths should be the same as in your locale pack (e.g. you have 'locale\en\ui\loading\gauge_empty.dds' file, move it in 'GAME_CLIENT_FOLDER\locale\en\ui\loading\' directory).

    Spoiler

    1xNkgcF.png

    Regards.

    • Love 1
  3. 29 minutes ago, ReFresh said:

    And, can you do that without checking shops is near to each other?

    Just comment this part:

    		SetShopValidPos(true);
    
    		CheckShopPos f(this);
    		sectree->ForEachAround(f);
    
    		if(!GetShopValidPos())
    		{
    			ChatPacket(CHAT_TYPE_INFO, "You cannot open a shop here (too close to other shop).");
    			return;
    		}

     

    30 minutes ago, ReFresh said:

    And how can I add new shop number? only with 30000, 30001 etc.?

    You need to add this numbers in 'struct CheckShopPos', something like this:

    			if (ch->GetRaceNum()!=30000 || !ch->GetRaceNum()!=30001) //shop mob vnum
    				return;

    or in case if you have some range of vnums (for example between 30000 and 30010):

    			if (ch->GetRaceNum() < 30000 && ch->GetRaceNum() > 30010) //shop mob vnum
    				return;

     

    • Love 2
  4. M2 Download Center

    This is the hidden content, please
    ( Internal )

    Hello!

    I'd like to show you how you can check position for shops (probably offline shops too).
    I don't like when the map is full of shops or when shops are too close for each other. So I've made few functions for checking if the shop is in safezone or if it too close to other shops.

    Let's start :)

    char.h

    Find there:

    		void			CloseMyShop();
    
    	protected:
    
    		LPSHOP			m_pkShop;
    		LPSHOP			m_pkMyShop;
    		std::string		m_stShopSign;
    		LPCHARACTER		m_pkChrShopOwner;

    Add few new lines:

    		void			CloseMyShop();
    		void			SetShopValidPos(bool value) { m_bShopValidPos = value; }
    		bool			GetShopValidPos() { return m_bShopValidPos; }
    
    	protected:
    
    		LPSHOP			m_pkShop;
    		LPSHOP			m_pkMyShop;
    		std::string		m_stShopSign;
    		LPCHARACTER		m_pkChrShopOwner;
    		bool			m_bShopValidPos;

    char.cpp

    In 'void CHARACTER::Initialize()' find:

    	m_pkMyShop		= NULL;

    Add below:

    	m_bShopValidPos = true;

    Then search for 'void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE bItemCount)'

    Add above new function:

    struct CheckShopPos
    {
    	LPCHARACTER m_ch;
    	CheckShopPos(LPCHARACTER ch)
    	{
    		m_ch = ch;
    	}
    
    	void operator()(LPENTITY ent)
    	{
    		if (ent->IsType(ENTITY_CHARACTER))
    		{
    			LPCHARACTER ch = (LPCHARACTER) ent;
    			if (ch->GetRaceNum()!=30000) //shop mob vnum
    				return;
    
    			if (DISTANCE_APPROX(ch->GetX() - m_ch->GetX(), ch->GetY() - m_ch->GetY()) < 200) //distance between shops
    			{
    				m_ch->SetShopValidPos(false);
    			}
    		}
    	}
    };

    Then in 'void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE bItemCount)' search for:

    	if (bItemCount == 0)
    		return;

    Add below:

    	//shops pos check
    	LPSECTREE sectree = GetSectree();
    	if (sectree)
    	{
    
    		SetShopValidPos(true);
    
    		CheckShopPos f(this);
    		sectree->ForEachAround(f);
    
    		if(!GetShopValidPos())
    		{
    			ChatPacket(CHAT_TYPE_INFO, "You cannot open a shop here (too close to other shop).");
    			return;
    		}
    
    		if (!sectree->IsAttr(GetX(), GetY(), ATTR_BANPK))
    		{
    			ChatPacket(CHAT_TYPE_INFO, "You cannot open a shop here (use safezone).");
    			return;
    		}
    	}
    	//shops pos check

     

    P.s:

    Spoiler

    1. Make backups before change your source.
    2. If you'll repost this solution somewhere, please keep credits.
    3. Likes and comments appreciated.

     

    That's all, have fun ;)
    Regards.

    • Metin2 Dev 2
    • Scream 1
    • Good 4
    • Love 10
  5. Hey @random, check out your item_proto,txt/item_names.txt on the server
    Make sure that 1st line doesn't contains any info about items. As far i remember the game skips 1st line in these files, and if there you have a row about gold (vnum 1) then it will be skipped => "Your problem".
     

    Spoiler

    examples:
    item_proto.txt 1st line:
    ITEM    ITEM_NAME(K)    ITEM_TYPE    SUB_TYPE    SIZE    ANTI_FLAG    FLAG    ITEM_WEAR    IMMUNE    SOMES    REFINE    REFINESET    MAGIC_PCT    LIMIT_TYPE0    LIMIT_VALUE0    LIMIT_TYPE1    LIMIT_VALUE1    ADDON_TYPE0    ADDON_VALUE0    ADDON_TYPE1    ADDON_VALUE1    ADDON_TYPE2    ADDON_VALUE2    VALUE0    VALUE1    VALUE2    VALUE3    VALUE4    VALUE5    Specular    SOCKET    ATTU_ADDON
    item_names.txt 1st line:
    VNUM    LOCALE_NAME

    P.S.: Also you need to check item_proto on client side, in case if you use for it item_names.txt/item_proto.txt

  6. As was advised above, you need to edit skill_proto (on this forum I've saw few topics about how to).

    If you want to see which values are in use for skill's calculations add next line in "void CSkillProto::SetPointVar" (skill.cpp file):

    sys_log(0,"CSkillProto::SetPointVar %d %s %f", dwVnum, strName.c_str(), dVar);

    Spoiler

    uBCmaWC.png

    Regards.

  7. Hello community.

    Below you'll find fix for this error "Process: SEQUENCE 33075400 mismatch 0xa7 != 0xcf header 10"
    Usually this error happening when _IMPROVED_PACKET_ENCRYPTION_ disabled.

    In desc.cpp find 'int DESC::ProcessInput()' there you'll find next rows:

                TEMP_BUFFER    tempbuf;
                LPBUFFER lpBufferDecrypt = tempbuf.getptr();
                buffer_adjust_size(lpBufferDecrypt, iSizeBuffer);

    Comment these lines and add below next line :

                LPBUFFER lpBufferDecrypt = buffer_new(iSizeBuffer);

     

    Then below you need to find 'buffer_read_proceed(m_lpInputBuffer, iBytesProceed);' add next line above:

                buffer_delete(lpBufferDecrypt);

    Spoiler

    should be something like this:

    224551Gc0hMnV.png

     

    P.S.: With current changes I don't have any troubles with header 10 anymore. And looks like the problem was in TEMP_BUFFER
    Feel free to like and comment if necessary ;)

    Regards.

    • Love 1
  8. 2 hours ago, ImBacK said:
    3 hours ago, metin2team said:

    this means that if you don't own the item the pet won't get it unless you have your char's name on it.

    so , if i want et pickup item without name and with name remove this  !item->IsOwnership(player)  ?

    bool CItem::IsOwnership(LPCHARACTER ch)
    {
        if (!m_pkOwnershipEvent)
            return true; //return true if item doesn't has ownership at all (item without name)

        return m_dwOwnershipPID == ch->GetPlayerID() ? true : false; //return true if item has ownership and it's belong to current player.
    }

    So you don't have to remove "!item->IsOwnership(player)" in order to "teach" your pet to pick up items "without names" ;)

     

    @Micha aka xCPx, I've found one more little bug in "pet pickup system" >> When two or more pets want to bring same item one of them disappears.
    Fix in the spoiler:

    Spoiler

    In order to fix I suggest add 'bool m_isFreeForPet;' to item class.

    How to:

    1. In item.h

    1.1 Find:

    bool        m_isLocked;

    Add below

    bool        m_isFreeForPet;

    1.2 Find:

    bool        isLocked() const { return m_isLocked; }

    Add below:

            void        SetFreeForPet(bool f) {m_isFreeForPet = f;}
            bool        isFreeForPet() const {return m_isFreeForPet; }

    2. In item.cpp

    Find:

    CItem::CItem(DWORD dwVnum)
        : m_dwVnum(dwVnum), m_bWindow(0), m_dwID(0), m_bEquipped(false), m_dwVID(0), m_wCell(0), m_dwCount(0), m_lFlag(0), m_dwLastOwnerPID(0),
        m_bExchanging(false), m_pkDestroyEvent(NULL), m_pkUniqueExpireEvent(NULL), m_pkTimerBasedOnWearExpireEvent(NULL), m_pkRealTimeExpireEvent(NULL),
        m_pkExpireEvent(NULL), 
           m_pkAccessorySocketExpireEvent(NULL), m_pkOwnershipEvent(NULL), m_dwOwnershipPID(0), m_bSkipSave(false), m_isLocked(false),
        m_dwMaskVnum(0), m_dwSIGVnum (0)

    Add to the end 'm_isFreeForPet(true)', will be something like this:

    CItem::CItem(DWORD dwVnum)
        : m_dwVnum(dwVnum), m_bWindow(0), m_dwID(0), m_bEquipped(false), m_dwVID(0), m_wCell(0), m_dwCount(0), m_lFlag(0), m_dwLastOwnerPID(0),
        m_bExchanging(false), m_pkDestroyEvent(NULL), m_pkUniqueExpireEvent(NULL), m_pkTimerBasedOnWearExpireEvent(NULL), m_pkRealTimeExpireEvent(NULL),
        m_pkExpireEvent(NULL), 
           m_pkAccessorySocketExpireEvent(NULL), m_pkOwnershipEvent(NULL), m_dwOwnershipPID(0), m_bSkipSave(false), m_isLocked(false),
        m_dwMaskVnum(0), m_dwSIGVnum (0), m_isFreeForPet(true)

     

    3. In PetSystem.cpp change "struct PetPickUpItemStruct"

    struct PetPickUpItemStruct
    {
        CPetActor * pet;
        int range;

        PetPickUpItemStruct(CPetActor * p, int r)
        {
            pet = p;
            range = r;
        }

        void operator()(LPENTITY pEnt)
        {
            if (!pet->GetOwner() || !pet->GetCharacter())
                return;
            if (pet->IsPickup())
                return;
            if (pEnt->IsType(ENTITY_ITEM) == true)
            {
                LPITEM item = (LPITEM)pEnt;
                LPCHARACTER player = pet->GetOwner();
                if (!item || !item->GetSectree() || !item->IsOwnership(player))
                    return;

                int iDist = DISTANCE_APPROX(item->GetX() - player->GetX(), player->GetY() - player->GetY());

                if (iDist > range)
                    return;

                if(item && item->isFreeForPet())
                {
                    item->SetFreeForPet(false);
                    pet->SetPickup(true);
                    pet->SetPickupItem(item);
                }
            }

        }
    };

    4. In char_item.cpp -> "bool CHARACTER::PickupItemByPet(DWORD dwVID)"

    Find this:

                if (item->GetType() == ITEM_QUEST)
                    quest::CQuestManager::instance().PickupItem(GetPlayerID(), item);

    Add below:

    item->SetFreeForPet(true);

     

    That's all.
    P.s: Let me know if you have better solution for this bug or if I'm wrong in something.

     

    Regards

  9. Hey, very useful and nice things. Thanks :)

    Few notes, regarding to pet pickup system:

    Spoiler

    Sometimes pet get "stuck" between owner and item.
    In order to fix I suggest to change in 'bool CPetActor::Update(DWORD deltaTime)'

    This:
    if (this->IsSummoned() && HasOption(EPetOption_Followable))
            bResult = bResult && this->_UpdateFollowAI();

    To:
    if (this->IsSummoned() && HasOption(EPetOption_Followable) && !IsPickup() && !GetPickupItem())
            bResult = bResult && this->_UpdateFollowAI();

     

    And one more:
    When pet want to bring item which already taken by someone else (other player or pet) it also get "stuck" on position where item was.
    I've fixed it with changing next in 'void CPetActor::BringItem()'

    This:
    if (!m_pkOwner || !m_pkChar || !item || !item->GetSectree())
            return;

    To:
    if (!m_pkOwner || !m_pkChar || !item || !item->GetSectree())
        {
            this->SetPickupItem(NULL);
            this->SetPickup(false);
            return;
        }

     

    • Love 2
  10. 17 minutes ago, VegaS said:
    30 minutes ago, wezt said:

    Here is an other way with using socket_pct from item_proto (you'll be able to set different effects for costumes):

    In UserInterface\InstanceBase.cpp -> UINT CInstanceBase::__GetRefinedEffect(CItemData* pItem) add after 'case CItemData::ITEM_TYPE_ARMOR:':

    
    
    	case CItemData::ITEM_TYPE_COSTUME:
    		if (refine < 7)
    			return 0;
    
    		if (pItem->GetSubType() == CItemData::COSTUME_BODY)
    		{
    			__ClearArmorRefineEffect();
    			m_armorRefineEffect = EFFECT_REFINED+EFFECT_BODYARMOR_REFINED7+refine-7;
    			__AttachEffect(m_armorRefineEffect);
    		}
    		break;

    Regards.

    Another solution easier:

     

    
    #ifdef __ENABLE_EFFECT_COSTUME_FUNCTION_PROTO_ 
    	case CItemData::ITEM_TYPE_COSTUME:
    	
    		if (pItem->GetSubType() == CItemData::COSTUME_BODY)
    		{
    			DWORD vnum = pItem->GetIndex();
    			long value_proto = pItem->GetValue(3);
    
    			if (value_proto == 1000)
    				__AttachEffect(EFFECT_REFINED+EFFECT_COSTUME_TITAN_1);
    			else  if (value_proto == 1500)
    				__AttachEffect(EFFECT_REFINED+EFFECT_COSTUME_TITAN_2);
    			else  if (value_proto == 2000)
    				__AttachEffect(EFFECT_REFINED+EFFECT_COSTUME_TITAN_3);
    			else  if (value_proto == 2500)
    				__AttachEffect(EFFECT_REFINED+EFFECT_COSTUME_TITAN_4);
    			else  if (value_proto == 3000)
    				__AttachEffect(EFFECT_REFINED+EFFECT_COSTUME_TITAN_5);
    		}
    }
    #endif

      

    Pls do not take it as some kind of competition :)


    But in my client I don't use anymore 'DWORD refine = max(pItem->GetRefine() + pItem->GetSocketCount(), CItemData::ITEM_SOCKET_MAX_NUM) - CItemData::ITEM_SOCKET_MAX_NUM;'

    I've made something like this:

    m_armorRefineEffect = EFFECT_REFINED+pItem->GetSocketCount();
    __AttachEffect(m_armorRefineEffect);

     

    This way more easier (IMHO) :)

    PS: Ofc for this way you'll need to edit values of socket_pct in whole item_proto.

    Regards.

    • Love 1
  11. Here is an other way with using socket_pct from item_proto (you'll be able to set different effects for costumes):

    In UserInterface\InstanceBase.cpp -> UINT CInstanceBase::__GetRefinedEffect(CItemData* pItem) add after 'case CItemData::ITEM_TYPE_ARMOR:':

    	case CItemData::ITEM_TYPE_COSTUME:
    		if (refine < 7)
    			return 0;
    
    		if (pItem->GetSubType() == CItemData::COSTUME_BODY)
    		{
    			__ClearArmorRefineEffect();
    			m_armorRefineEffect = EFFECT_REFINED+EFFECT_BODYARMOR_REFINED7+refine-7;
    			__AttachEffect(m_armorRefineEffect);
    		}
    		break;

    Regards.

    • Love 1
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.