-
Posts
656 -
Joined
-
Last visited
-
Days Won
187 -
Feedback
100%
Content Type
Forums
Store
Third Party - Providers Directory
Feature Plan
Release Notes
Docs
Events
Posts posted by VegaS™
-
-
-
-
-
M2 Download Center
( Internal )
( GitHub )
I added two years ago a small function that allow you to make a struct like C++ for different purposes.
# Example #1
pack = ui.RegisterStructClass('a b c')(15, {}, []) pack.a += 50 pack.b.update({0: 250}) pack.c.append(100) print (pack.a, pack.b, pack.c)
# Example #2.
def Transfer(self, p): print(p.szName, p.lX, p.lY) self.Transfer(ui.RegisterStructClass('szName lX lY')(GetName(), GetX(), GetY()))
# Example #3.
config = ui.RegisterStructClass('width height default_size_dict rank_list text')(450, 300, {'w': 400, 'h': 500}, [1, 2, 3], 'Metin2') print ( config.width, config.height, config.text, config.default_size_dict.get('w'), config.default_size_dict.get('h'), config.rank_list )
Repository:
- 10
- 1
- 1
- 1
- 3
- 1
- 6
-
-
Updated v1.1 - Fixed limited string format
-
29 minutes ago, ReFresh said:
Could it look like this?
No, you need to add the condition before inserting the entity.
Spoilerclass CFuncViewInsert { private: int dwViewRange; public: LPENTITY m_me; CFuncViewInsert(LPENTITY ent) : dwViewRange(VIEW_RANGE + VIEW_BONUS_RANGE), m_me(ent) { } void operator () (LPENTITY ent) { // 오브젝트가 아닌 것은 거리를 계산하여 거리가 멀면 추가하지 않는다. if (!ent->IsType(ENTITY_OBJECT)) if (DISTANCE_APPROX(ent->GetX() - m_me->GetX(), ent->GetY() - m_me->GetY()) > dwViewRange) return; #ifdef HIDDEN_OX if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { const LPCHARACTER chMe = static_cast<LPCHARACTER>(m_me); const LPCHARACTER chEnt = static_cast<LPCHARACTER>(ent); if (chMe->GetMapIndex() == OXEVENT_MAP_INDEX && !chMe->IsGM() && !chEnt->IsGM()) return; } #endif // 나를 대상에 추가 m_me->ViewInsert(ent); // 둘다 캐릭터면 if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { LPCHARACTER chMe = (LPCHARACTER) m_me; LPCHARACTER chEnt = (LPCHARACTER) ent; // 대상이 NPC면 StateMachine을 킨다. if (chMe->IsPC() && !chEnt->IsPC() && !chEnt->IsWarp() && !chEnt->IsGoto()) chEnt->StartStateMachine(); } } };
Don't forget:
- entity_view.cpp
#include "OXEvent.h"
- service.h
#define HIDDEN_OX
-
1 hour ago, Cripplez said:
How exactly i can add a new vnum here? like this?
if (2493 || 2499 == m_pkMobData->m_table.dwVnum)
if (m_pkMobData->m_table.dwVnum == 2493 || m_pkMobData->m_table.dwVnum == 2499)
- 1
- 1
- 4
-
31 minutes ago, ReFresh said:
I got some error when I tried to compile source:
source\gamelib\../UserInterface/AbstractPlayer.h(30): error C2061: syntax error : identifier 'TItemPos'
- UserInterface/AbstractPlayer.h
Try to include:
#include "GameType.h"
- 4
-
The idea isn't so bad, but the code has too many useless lines, here's what you can do to improve it.
def RefreshPickupFilter(self): #Weapon if systemSetting.IsPickUpFilterWeapon(): self.PickUpFilterList[0].Down() else: self.PickUpFilterList[0].SetUp() #Armor if systemSetting.IsPickUpFilterArmor(): self.PickUpFilterList[1].Down() else: self.PickUpFilterList[1].SetUp() #Ear if systemSetting.IsPickUpFilterEar(): self.PickUpFilterList[2].Down() else: self.PickUpFilterList[2].SetUp() #Neck if systemSetting.IsPickUpFilterNeck(): self.PickUpFilterList[3].Down() else: self.PickUpFilterList[3].SetUp() #Foots if systemSetting.IsPickUpFilterFoots(): self.PickUpFilterList[4].Down() else: self.PickUpFilterList[4].SetUp() #Shield if systemSetting.IsPickUpFilterShield(): self.PickUpFilterList[5].Down() else: self.PickUpFilterList[5].SetUp() #Book if systemSetting.IsPickUpFilterBook(): self.PickUpFilterList[6].Down() else: self.PickUpFilterList[6].SetUp() #Stone if systemSetting.IsPickUpFilterStone(): self.PickUpFilterList[7].Down() else: self.PickUpFilterList[7].SetUp() #Etc if systemSetting.IsPickUpFilterEtc(): self.PickUpFilterList[8].Down() else: self.PickUpFilterList[8].SetUp()
To:
def RefreshPickupFilter(self): checkFilterList = ( systemSetting.IsPickUpFilterWeapon(), systemSetting.IsPickUpFilterArmor(), systemSetting.IsPickUpFilterEar(), systemSetting.IsPickUpFilterNeck(), systemSetting.IsPickUpFilterFoots(), systemSetting.IsPickUpFilterShield(), systemSetting.IsPickUpFilterBook(), systemSetting.IsPickUpFilterStone(), systemSetting.IsPickUpFilterEtc() ) for child, flag in zip(self.PickUpFilterList, checkFilterList): if flag: child.Down() else: child.SetUp()
self.PickUpFilterList.append(GetObject("Pick_Up_FilterWeapon")) self.PickUpFilterList.append(GetObject("Pick_Up_FilterArmor")) self.PickUpFilterList.append(GetObject("Pick_Up_FilterEar")) self.PickUpFilterList.append(GetObject("Pick_Up_FilterNeck")) self.PickUpFilterList.append(GetObject("Pick_Up_FilterFoots")) self.PickUpFilterList.append(GetObject("Pick_Up_FilterShield")) self.PickUpFilterList.append(GetObject("Pick_Up_FilterBook")) self.PickUpFilterList.append(GetObject("Pick_Up_FilterStone")) self.PickUpFilterList.append(GetObject("Pick_Up_FilterEtc"))
To:
for name in ('Weapon','Armor','Ear','Neck','Foots','Shield','Book','Stone','Etc'): self.PickUpFilterList.append(GetObject("Pick_Up_Filter{}".format(name)))
self.PickUpFilterList[0].SetToggleUpEvent(self.__OnClickPickupFilterButtonWeapon) # Weapon self.PickUpFilterList[0].SetToggleDownEvent(self.__OnClickPickupFilterButtonWeapon) # Weapon self.PickUpFilterList[1].SetToggleUpEvent(self.__OnClickPickupFilterButtonArmor) # Armor self.PickUpFilterList[1].SetToggleDownEvent(self.__OnClickPickupFilterButtonArmor) # Armor self.PickUpFilterList[2].SetToggleUpEvent(self.__OnClickPickupFilterButtonEar) # Ear self.PickUpFilterList[2].SetToggleDownEvent(self.__OnClickPickupFilterButtonEar) # Ear self.PickUpFilterList[3].SetToggleUpEvent(self.__OnClickPickupFilterButtonNeck) # Neck self.PickUpFilterList[3].SetToggleDownEvent(self.__OnClickPickupFilterButtonNeck) # Neck self.PickUpFilterList[4].SetToggleUpEvent(self.__OnClickPickupFilterButtonFoots) # Foots self.PickUpFilterList[4].SetToggleDownEvent(self.__OnClickPickupFilterButtonFoots) # Foots self.PickUpFilterList[5].SetToggleUpEvent(self.__OnClickPickupFilterButtonShield) # Shield self.PickUpFilterList[5].SetToggleDownEvent(self.__OnClickPickupFilterButtonShield) # Shield self.PickUpFilterList[6].SetToggleUpEvent(self.__OnClickPickupFilterButtonBook) # Books self.PickUpFilterList[6].SetToggleDownEvent(self.__OnClickPickupFilterButtonBook) # Books self.PickUpFilterList[7].SetToggleUpEvent(self.__OnClickPickupFilterButtonStone) # Stone self.PickUpFilterList[7].SetToggleDownEvent(self.__OnClickPickupFilterButtonStone) # Stone self.PickUpFilterList[8].SetToggleUpEvent(self.__OnClickPickupFilterButtonEtc) # Etc self.PickUpFilterList[8].SetToggleDownEvent(self.__OnClickPickupFilterButtonEtc) # Etc
To:
eventFuncList = ( self.__OnClickPickupFilterButtonWeapon, self.__OnClickPickupFilterButtonArmor, self.__OnClickPickupFilterButtonEar, self.__OnClickPickupFilterButtonNeck, self.__OnClickPickupFilterButtonFoots, self.__OnClickPickupFilterButtonShield, self.__OnClickPickupFilterButtonBook, self.__OnClickPickupFilterButtonStone, self.__OnClickPickupFilterButtonEtc ) for child, event in zip(self.PickUpFilterList, eventFuncList): child.SetToggleUpEvent(event) child.SetToggleDownEvent(event)
- 25
- 2
- 1
- 1
- 8
- 4
- 42
-
1 hour ago, sonyc73 said:
after tests is doing crash core, but i don`t know why
There's no check for victim pointer.
// Replace: if (pkVictim->GetParty()) // With: if (pkVictim && pkVictim->GetParty())
- 2
-
On 9/23/2019 at 10:29 PM, Rakancito said:
if (pkAttacker->IsRiding()) { bool bAttacking = (get_dword_time() - pkAttacker->GetLastAttackTime()) < 800; if (!bAttacking) return BATTLE_NONE; } else { bool bAttacking = (get_dword_time() - pkAttacker->GetLastAttackTime()) < 750; if (!bAttacking) return BATTLE_NONE; }
Let's don't kill the source with dozens of useless lines and duplicated.
const bool bAttacking = (get_dword_time() - pkAttacker->GetLastAttackTime()) < pkAttacker->IsRiding() ? 800 : 700; if (!bAttacking) return BATTLE_NONE;
- 3
-
On 9/25/2019 at 1:50 AM, ManiacRobert said:Spoiler
void operator () (LPENTITY ent) { // 오브젝트가 아닌 것은 거리를 계산하여 거리가 멀면 추가하지 않는다. if (!ent->IsType(ENTITY_OBJECT)) if (DISTANCE_APPROX(ent->GetX() - m_me->GetX(), ent->GetY() - m_me->GetY()) > dwViewRange) return; #ifdef HIDDEN_OX if (ent->IsType(ENTITY_CHARACTER) && m_me->IsType(ENTITY_CHARACTER)) { LPCHARACTER chMe = (LPCHARACTER)m_me; LPCHARACTER chEnt = (LPCHARACTER)ent; if (chMe->IsPC() && chEnt->IsPC() && !chMe->IsGM() && !chEnt->IsGM() && chMe->GetMapIndex() == 113 && chEnt->GetMapIndex() == 113) return; } #endif
Since already is a check for distance, is impossible that the entity to be in another map, so is enough to check if you're in the map.
- 38
- 1
- 8
- 2
- 16
-
-
Check if passed 10 seconds after the action for:- Safebox, exchange, shop, refine
Check if the window is open:
- Exchange, shop, private shop, safebox, cube
How-To-Use: (already a lot of metin2 quests using this)
Spoilerwhen 50513.use begin if not pc.can_warp() then syschat("Wait 10 seconds, you can't make this right now.") return end ----- end
- 1
-
std::string g_strEffectName = "d:/ymir work/effect/etc/direction/direction_land.mse";
-
-
-
-
-
9 hours ago, zeimpekis9 said:
How i modify it, to mob_drop_item etc?
Here you've some hints, good luck.
- 4
-
You should use a string format method, instead of convert an integer to string then concatenate two strings for no reason.
- 1
- 4
-
Designed by Chaccc
Spoiler- 3
-
@PACI @DevChuckNorris @arves100
Spoiler- 1
- 3
Python Timer Like Queue
in Programming & Scripts
Posted
Thanks for release, the idea isn't bad, but there're some bad things.
I'll show you the problems part and how can be improved, there're just advices, i hope you'll get them.
If you're using Python 2+ or Python 3.2 and below, you can't use the clear() method (allowed on 3.3+), also as i said in the second message you don't need to check the length of the list, already the clear() method doing that inside and there's no reason to put it to __del__ method, it will be called when the object is garbage collected. if you really want to use in future, something outside of this and want just to check the list if isn't empty, is enough to do it just with if some_list, like a normal boolean, there no need to check the length of the list if you don't use it in your code.
You don't have to check the list if you already did a numeric range loop or iterator based loop.
I would say to use app.GetGlobalTimeStamp() instead of app.GetTime(), if you teleport while the event is running, the event function will run after 10 seconds like. While app.GetGlobalTimeStamp() will run after the specific time, because is the server timestamp and is updated on each enter in game.
I would put here an big exclamation, with this you creating 999999999 lines in syserr, what you do here is like:
While Process() function is called in OnUpdate, so, your condition trying to get the returned value from an specific function, what means the next update time or 0 to destroy the event/clear it. Everything's fine until you return 0 and event should be stopped yes? But there is a problem, you clear the specific dictionary of event and still remained in the list [{}], and the Process() function will take your self.eventList with the items included, the empty dictionaries from your events, and of course even if you've [{}, {}, {}], that doesn't mean your list is empty, have 3 items, so, the loop will trying to read an empty dictionary and you'll get key errors in each milisecond. The method which you need is to delete the dictionary itself from the list after the result value from the function is 0, like this:
_______________________________________
I wrote fast some self extensions, if somebody is interested i'll do another updates in the next days.
_______________________________________
The code:
PS: Don't quote this reply, will be updated.