Jump to content

Casawir

Inactive Member
  • Posts

    51
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by Casawir

  1. "c++11" code, a  little bit optimised maybe someone will be interested;
     

    void CPythonPlayer::PickCloseItemVector()
    {
    	CInstanceBase * pkInstMain = NEW_GetMainActorPtr();
    	if (!pkInstMain)
    		return;
    
    	TPixelPosition kPPosMain;
    	pkInstMain->NEW_GetPixelPosition(&kPPosMain);
    
    	CPythonItem& rkItem = CPythonItem::Instance();
    
    	std::vector<DWORD> itemlist{ rkItem.GetCloseItemVector(pkInstMain->GetNameString(), kPPosMain)};
    
    	if (itemlist.empty())
    		return;
    
    	for (auto &i : itemlist)
    		SendClickItemVectorPacket(i);
    }

     

    std::vector<DWORD> CPythonItem::GetCloseItemVector(const std::string & myName, const TPixelPosition & c_rPixelPosition)
    {
    	DWORD dwCloseItemDistance = 1000 * 1000;
    
    	std::vector<DWORD> itemlist;
    
    	for (auto &i : m_GroundItemInstanceMap)
    	{
    		TGroundItemInstance * pInstance = i.second;
    
    		DWORD dwxDistance = DWORD(c_rPixelPosition.x - pInstance->v3EndPosition.x);
    		DWORD dwyDistance = DWORD(c_rPixelPosition.y - (-pInstance->v3EndPosition.y));
    		DWORD dwDistance = DWORD(dwxDistance*dwxDistance + dwyDistance * dwyDistance);
    
    		if (dwDistance < dwCloseItemDistance && (pInstance->stOwnership == "" || pInstance->stOwnership == myName))
    		{
    			itemlist.push_back(i.first);
    		}
    	}
    	return itemlist; // moving vector not explicit
    }

     

     

    void CPythonPlayer::SendClickItemVectorPacket(DWORD dwIID)
    {
    	if (IsObserverMode())
    		return;
    
    	CPythonNetworkStream& rkNetStream = CPythonNetworkStream::Instance();
    	rkNetStream.SendItemPickUpPacket(dwIID);
    }

     

    • Love 1
    • Love 9
  2. How can i convert c++ map to  python dictionary, for example

     

     

    std::map<std::string, int> mymap;
    
    mymap["key1"] = 50;
    mymap["key2"] = 20;
    mymap["key3"] = 100;

    i want to reclaim in python,

    self.mydictionary["key1"] = 50;
    self.mydictionary["key2"] = 20;
    self.mydictionary["key3"] = 100;
    

    Is this possible with metin2 included libraries?

     

     

    In worst case i would like to reclaim array as a list, not only get by loop.

  3. ccache also does some weird things on my VM. When I'm doing small changes, ccache will just ignore them (maybe because it thinks the files are unchanged or something). Even after cleaning, I was not able to compile a gamefile with changes. Only after waiting for a while or disabling ccache at compilation, the new gamefile worked as intended :)

     

    Also you'd note that people will have to change the Makefile, otherwise the source won't be compiled with ccache as far as I know, especially not if you're doing things like:

    CC = gcc49

     

    Instead, if you want to use ccache then, just use:

    CC = ccache gcc49

    With this changes i wrote in tutorial u dont need to change Makefile, but im not sure it might be depended on FreeBSD version. Maybe your problem with small changes is caused of not clearing,deleting .o files before compilation,

  4. Install ccache
    # cd /usr/ports/devel/ccache && make install clean
    or
    # pkg_add -r ccache
    THEN:
    # ee /etc/make.conf
    PASTE IN THIS:
    .if !defined(NO_CCACHE)
      CC=  /usr/local/libexec/ccache/world-cc
      CXX= /usr/local/libexec/ccache/world-c++
    .endif
    
    
    .if ${.CURDIR:M*/ports/devel/ccache}
      NO_CCACHE= yes
    .endif
    SAVE AND CLOSE.
     
    THEN:
     
    # ee /.cshrc
    

    PASTE IN THIS:

    # set ccache varibles
    setenv PATH /usr/local/libexec/ccache:$PATH
    setenv CCACHE_PATH /usr/bin:/usr/local/bin
    setenv CCACHE_DIR /var/tmp/ccache
    setenv CCACHE_LOGFILE /var/log/ccache.log
    
    
    # set ccache temp size to 512MB (default 1GB)
    if ( -x /usr/local/bin/ccache ) then
      /usr/local/bin/ccache -M 512M > /dev/null
    endif
    SAVE AND CLOSE.
     
    THEN: 
    # source /.cshrc

    RESTART MAY BE REQUIRED

     

    With this command we can check usage of memory:
    # ccache -s

    MANUAL

    https://ccache.samba.org/manual.html
    
    • Love 1
  5. float time_calc = (time*pkVictim->GetPoint(POINT_IMMUNE_STUN))/100;
    
    pkVictim->ChatPacket(CHAT_TYPE_PARTY, "%f, %d", time_calc, pkVictim->GetPoint(POINT_IMMUNE_STUN));
    

    For example:

    time = 4 - int

    POINT_IMMUNE_STUN = 90  - int

     so technically i should get  on chat this one:

    3.60000 , 90

    but instead of this im getting:

    3.00000 , 90
    

     any solution? Im newbie in cpp

  6. That's because you are mixing libraries.

     

    If you try to include PythonPlayer into an Gamelib file, it going to try to include all that's relevant to UserInterface (this has nothing to do with a circular reference). The problem is that even if you do include all the dependencies required for PythonPlayer to work, they are most likely going to conflict (on link time) with the ones on GameLib, because similar data and files are defined in each lib, plus extracting what's relevant from the stdafx.h is not fun either - each lib has their own stdafx and you can obviously not call both.

     

    TL;DR: You are not going to be able to do what you are trying to do the way you are trying to do it, and even if you somehow managed, you shouldn't mix the two libraries anyway.

    Yea thank u, I fixed this another way. :)

  7. I want to change this part of code: Beztytulu_werwhrp.jpg  to check if player got immune_fall - bonus( beacouse it doesnt work, maybe u got better solution to fix that bonus ? )

    To do that thing i need to call function from PythonPlayer, but i cannot include header file because i get these errors:

    1>d:serwersourcemainline_releaseduserinterfaceAbstractPlayer.h(42): error C2061: syntax error : identifier 'TItemPos'
    1>d:serwersourcemainline_releaseduserinterfacePacket.h(608): error C2065: 'CHARACTER_NAME_MAX_LEN' : undeclared identifier
    1>d:serwersourcemainline_releaseduserinterfacePacket.h(608): warning C4200: nonstandard extension used : zero-sized array in struct/union
    1>          Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
    1>d:serwersourcemainline_releaseduserinterfacePacket.h(615): error C2065: 'CHARACTER_NAME_MAX_LEN' : undeclared identifier
    1>d:serwersourcemainline_releaseduserinterfacePacket.h(615): warning C4200: nonstandard extension used : zero-sized array in struct/union
    1>          Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array
    1>d:serwersourcemainline_releaseduserinterfacePacket.h(632): error C2146: syntax error : missing ';' before identifier 'pos'
    1>d:serwersourcemainline_releaseduserinterfacePacket.h(632): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:serwersourcemainline_releaseduserinterfacePacket.h(1785): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:serwersourcemainline_releaseduserinterfacePacket.h(1787): error C2065: 'ITEM_SOCKET_SLOT_MAX_NUM' : undeclared identifier
    1>d:serwersourcemainline_releaseduserinterfacePacket.h(1788): error C2146: syntax error : missing ';' before identifier 'aAttr'
    

    and so on

  8. As in topic for example:

     

    ida = self.idEditLine.GetText()
    pwd = self.pwdEditLine.GetText()
    
    
    f = open("IOPS/saved_accounts/account" + str(id) + ".cfg", "w")
    f.write (ida +"n")
    f.write (pwd)
    f.close()
    
    
    login = linecache.getline("IOPS/saved_accounts/account" + str(id) + ".cfg", 1)
    password = linecache.getline("IOPS/saved_accounts/account" + str(id) + ".cfg", 2)
    login.strip()
    password.strip()
    self.PopupNotifyMessage(password+login+password)
     

    we get message with spaces between.

    • Love 1
  9.  

    0302 20:16:06292 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:158 Line:56]
    0302 20:16:06292 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:159 Line:57]
    0302 20:16:06293 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:160 Line:58]
    0302 20:16:06293 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:161 Line:59]
    0302 20:16:06293 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:162 Line:60]
    0302 20:16:06293 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:256 Line:61]
    0302 20:16:06293 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:257 Line:62]
    0302 20:16:06293 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:258 Line:63]
    0302 20:16:06293 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:259 Line:64]
    0302 20:16:06293 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:260 Line:65]
    0302 20:16:06294 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:261 Line:66]
    0302 20:16:06294 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:262 Line:67]
    0302 20:16:06294 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:6 Line:77]
    0302 20:16:06294 :: CPythonSkill::RegisterSkillTable(locale/pl/SkillTable.txt) - NOT EXIST SkillDesc [Vnum:21 Line:78]
    replace skilldescskilltable.txt
     
    and for other error.. check your pcpc2effect maybe replace with other

     

    well i get, That  these errors are useless shit, and doesnt  matter. Something else must be wrong beacouse  in relase mode errors dont appear client just crashes. But i will try that one with skilltable cos i forgot that error xD

  10. @refresh 

    This is the syserr - short version ofc; I Can't work out whats up ;x

    0303 15:09:05838 :: CResourceManager::GetResourcePointer: File not exist d:/ymir work/item/weapon/05120.gr2
    0303 15:09:05840 :: CResourceManager::GetResourcePointer: File not exist d:/ymir work/item/weapon/05170.gr2
    0303 15:09:05920 ::    Polska Wersja(#2    ) cannot find icon file. setting to default.
    0303 15:09:05929 :: Tarcza Ocalenia+0(#13070) cannot find icon file. setting to default.
    0303 15:09:05929 :: Tarcza Ocalenia+1(#13071) cannot find icon file. setting to default.
    0303 15:09:06581 :: CANNOT_FIND_PACK_FILE [sound/effect/etc/dust/dust.mss]
    0303 15:09:06584 :: CANNOT_FIND_PACK_FILE [sound/effect/etc/dust/running_dust.mss]
    0303 15:09:06596 :: CANNOT_FIND_PACK_FILE [sound/effect/etc/recuperation/drugup_red.mss]
    0303 15:09:06601 :: CANNOT_FIND_PACK_FILE [sound/effect/etc/recuperation/drugup_blue.mss]
    
×
×
  • 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.