Jump to content

Abel(Tiger)

Active+ Member
  • Posts

    196
  • Joined

  • Last visited

  • Days Won

    14
  • Feedback

    0%

Posts posted by Abel(Tiger)

  1. For minimap:

    		else if (pkInstEach->IsNPC())
    		{
    			if (pkInstEach->GetRace() == 20135) // if (pkInstEach->IsStructure())
    				continue;
    			
    			aMarkPosition.m_fX = ( m_fWidth - (float)m_WhiteMark.GetWidth() ) / 2.0f + fDistanceFromCenterX + m_fScreenX;
    			aMarkPosition.m_fY = ( m_fHeight - (float)m_WhiteMark.GetHeight() ) / 2.0f + fDistanceFromCenterY + m_fScreenY;
    
    			m_NPCPositionVector.push_back(aMarkPosition);
    		}

    For atlas:

    // regen.cpp
    				else if (p->m_table.bType == CHAR_TYPE_NPC || p->m_table.bType == CHAR_TYPE_WARP || p->m_table.bType == CHAR_TYPE_GOTO)
    				{
    					if(p->m_table.dwVnum == 20135)
    						continue;
    					
    					SECTREE_MANAGER::instance().InsertNPCPosition(lMapIndex,
    							p->m_table.bType,
    							p->m_table.szLocaleName,
    							(regen->sx+regen->ex) / 2 - base_x,
    							(regen->sy+regen->ey) / 2 - base_y);
    				}

     

    • Love 1
  2. The official servers already did that for begginers weapons with antiflag.

    Spoiler
    
    /* 1. item_lenght.h <==> This step you need to repeat for ItemData.h (GameLib) */
    // 1.1. Search:
    	ITEM_ANTIFLAG_WOLFMAN		= (1 << 18),
    // 1.1. Add after:
    	ITEM_ANTIFLAG_REINFORCE		= (1 << 19),
    	ITEM_ANTIFLAG_ENCHANT		= (1 << 20),
    	
    	
    /* 2. char_item.cpp */
    // 2.1. Search:
    		case USE_CHANGE_ATTRIBUTE :
    // 2.1. Add after:	< if(item2->GetAttributeSetIndex() == -1) >
    			if (IS_SET(item2->GetAntiFlag(), ITEM_ANTIFLAG_ENCHANT))
    			{
    				ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't change a bonus in this item."));
    				return false;
    			}
    									
    									
    // 2.2. Search:
    		case USE_ADD_ATTRIBUTE :
    // 2.2. Add after:	< if (item2->GetAttributeSetIndex() == -1) >
    			if (IS_SET(item2->GetAntiFlag(), ITEM_ANTIFLAG_REINFORCE))
    			{
    				ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't add a bonus in this item."));
    				return false;
    			}
    		
    		
    /* 3. ProtoReader.cpp <==> This step you need to repeat for ItemCSVReader.cpp (Dump Proto) */
    // 3.1. Search:
    	"ANTI_WOLFMAN",
    // 3.1. Add after:
    	"ANTI_REINFORCE", "ANTI_ENCHANT"
    								
    
    /* 4. PythonItemModule.cpp */
    // 4.1. Search:
    	PyModule_AddIntConstant(poModule, "ITEM_ANTIFLAG_WOLFMAN",		CItemData::ITEM_ANTIFLAG_WOLFMAN);
    // 4.1. Add after:
    	PyModule_AddIntConstant(poModule, "ITEM_ANTIFLAG_REINFORCE", 		CItemData::ITEM_ANTIFLAG_REINFORCE);
    	PyModule_AddIntConstant(poModule, "ITEM_ANTIFLAG_ENCHANT",		CItemData::ITEM_ANTIFLAG_ENCHANT);
    								

     

     

    • Love 6
  3. Spoiler
    
    ## uitooltip.py
    ## 1. Search:
    							self.AppendTextLine(localeInfo.TOOLTIP_MEMORIZED_POSITION % (localeMapName, int(xPos-xBase)/100, int(yPos-yBase)/100), self.NORMAL_COLOR)
    ## 1. Add after:
    							self.AppendMapImage(mapName, int(xPos-xBase)/100, int(yPos-yBase)/100)
    
    
    ## 2. Search function:
    	def __DragonSoulInfoString (self, dwVnum):
    		...
    ## 2. Add after:
    	def AppendMapImage(self, mapName, xPos, yPos):
    		mapImage = ui.ImageBox()
    		mapImage.SetParent(self)
    		mapImage.Show()
    		mapImage.LoadImage("d:/ymir work/ui/atlas/%s/atlas.sub" % (mapName))
    		mapImage.SetPosition(0, self.toolTipHeight)
    		mapImage.SetWindowHorizontalAlignCenter()
    		
    		mapSizeDict = {
    			"metin2_map_c1" : [4, 5],
    		}
    		
    		if mapName in mapSizeDict:
    			pointImageX = (xPos / float(mapSizeDict[mapName][0] * (128 * 200)) * float(mapImage.GetWidth())) * 100 - 15.0
    			pointImageY = (yPos / float(mapSizeDict[mapName][1] * (128 * 200)) * float(mapImage.GetHeight())) * 100 - 15.0
    			
    			pointImage = ui.AniImageBox()
    			pointImage.SetParent(mapImage)
    			pointImage.SetDelay(6)
    			for i in xrange(1, 13):
    				pointImage.AppendImage("d:/ymir work/ui/minimap/mini_waypoint%02d.sub" % i)
    			pointImage.SetPosition(pointImageX, pointImageY)
    			pointImage.Show()
    		
    		self.toolTipHeight += mapImage.GetHeight()
    		self.childrenList.append(mapImage)
    		if mapName in mapSizeDict:
    			self.childrenList.append(pointImage)
    		self.ResizeToolTip()

     

    That's the hard way ... 

    Please don't say it's ugly code, I know it.

    • Love 7
  4. --- 0.0420000553131 seconds tierrilopes execution time ---

    --- 0.0659999847412 seconds Tasho execution time ---

    Who the f**k care about 0.02 seconds ? You can do a lot of things in those seconds ...

    Rewrite an entire file and then you see a difference , not from 2 code lines.

    • Sad 2
    • Love 1
  5. Well, In DirectQuery:

    screenshot_64.png

    Spoiler
    
    void CNewPetActor::Unsummon()
    {
    	if (true == this->IsSummoned())
    	{
    		LPITEM pSummonItem = ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID());
    		
    		if (pSummonItem != NULL)
    		{
    			std::auto_ptr<SQLMsg> pmsg2(DBManager::instance().DirectQuery("UPDATE new_petsystem SET level = %d, evolution=%d, exp=%d, expi=%d, bonus0=%d, bonus1=%d, bonus2=%d, skill0=%d, skill0lv= %d, skill1=%d, skill1lv= %d, skill2=%d, skill2lv= %d, duration=%d, tduration=%d WHERE id = %lu ", this->GetLevel(), this->m_dwevolution, this->GetExp(), this->GetExpI(), this->m_dwbonuspet[0][1], this->m_dwbonuspet[1][1], this->m_dwbonuspet[2][1], this->m_dwskillslot[0], this->m_dwskill[0], this->m_dwskillslot[1], this->m_dwskill[1], this->m_dwskillslot[2], this->m_dwskill[2], this->m_dwduration, this->m_dwtduration, pSummonItem->GetID()));
    			this->ClearBuff();
    
    			for (int b = 0; b < 3; b++)
    			{
    				pSummonItem->SetForceAttribute(b, 1, m_dwbonuspet[b][1]);
    			}
    			
    			pSummonItem->SetForceAttribute(3, 1, m_dwduration);
    			pSummonItem->SetForceAttribute(4, 1, m_dwtduration);
    			pSummonItem->SetSocket(1,m_dwlevel);
    			pSummonItem->SetSocket(0, false);
    			pSummonItem->Lock(false);
    		}
    		
    		this->SetSummonItem(NULL);
    		
            if (NULL != m_pkOwner)
                m_pkOwner->ComputePoints();
    
    		if (NULL != m_pkChar)
    			M2_DESTROY_CHARACTER(m_pkChar);
    
    		m_pkChar = 0;
    		m_dwVID = 0;
    		m_dwlevel = 1;
    		m_dwlevelstep = 0;
    		m_dwExpFromMob = 0;
    		m_dwExpFromItem = 0;
    		m_dwexp = 0;
    		m_dwexpitem = 0;
    		m_dwTimePet = 0;
    		m_dwImmTime = 0;
    		m_dwslotimm = 0;
    
    		for (int s = 0; s < 9; ++s) 
    		{
    			m_dwpetslotitem[s] = -1;
    		}
    		
    		ClearBuff();
    		m_pkOwner->ChatPacket(CHAT_TYPE_COMMAND, "PetUnsummon");
    	}
    }

     

     

    • Love 2
  6. bool CNewPetSystem::Update(DWORD deltaTime)
    {
    	bool bResult = true;
    
    	DWORD currentTime = get_dword_time();
    	
    	if (m_dwUpdatePeriod > currentTime - m_dwLastUpdateTime)
    		return true;
    	
    	std::vector <CNewPetActor*> v_garbageActor;
    
    	for (TNewPetActorMap::iterator iter = m_petActorMap.begin(); iter != m_petActorMap.end(); ++iter)
    	{
    		CNewPetActor* petActor = iter->second;
    
    		if (0 != petActor && petActor->IsSummoned())
    		{
    			LPCHARACTER pPet = petActor->GetCharacter();
              
    			if(pPet)
         			{
    				if (NULL == CHARACTER_MANAGER::instance().Find(pPet->GetVID()))
    				{
    					v_garbageActor.push_back(petActor);
    				}
    				else
    				{
    					bResult = bResult && petActor->Update(deltaTime);
    				}
          			}
    		}
    	}
    	for (std::vector<CNewPetActor*>::iterator it = v_garbageActor.begin(); it != v_garbageActor.end(); it++)
    		DeletePet(*it);
    
    	m_dwLastUpdateTime = currentTime;
    
    	return bResult;
    }

    I don't think that is "bt full" but try like above.

×
×
  • 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.