2.7 KiB
2.7 KiB
addEventHandlerreplaced with decorator event
@pyg2o.event('onInit')
async def evtInitFirst():
print('Hello')
@pyg2o.event('onInit', 100) # '100' is priority
async def evtInitSecond():
print('World')
- Positional arguments inside event handles replaced with keyword arguments (see names of all keywords on the each event page)
@pyg2o.event('onPlayerChangeColor')
async def evtColor(playerid, r, g, b):
pass
callEventnow also requires to pass keyword arguments instead of positional arguments
@pyg2o.event('MyTestEvent')
async def testEvt(name, id):
print(name, id)
g2o.callEvent('MyTestEvent', name = 'aurumvorax', id = 15)
# OR
g2o.callEvent('MyTestEvent', {'name': 'aurumvorax', 'id': 15})
# OR
args = {'name': 'aurumvorax', 'id': 15}
asyncio.create_task(pyg2o.callEvent('MyTestEvent', args))
cancelEventtemporarily disabled
isEventCancelledreplaced with built-in function propertycancelled, alongside with theeventName
@pyg2o.event('onPlayerDropItem')
async def evtDrop(**kwargs):
print(evtDrop.cancelled)
print(evtDrop.eventName)
Now all constants should be called via Constant class
import pyg2o
@pyg2o.event('onInit')
async def evt_init():
print(pyg2o.Constant.SERVER_SIDE)
-
Following functions and classes have been removed RIP :(
md5sha1sha256sha384sha512setReloadCallbacksetUnloadCallbackgetTimerExecuteTimesgetTimerIntervalkillTimersetTimersetTimerExecuteTimessetTimerIntervalsscanfhexToRgbrgbToHexgetTickCounteventValuegetPlayerMagicLevelsetPlayerMagicLevelPacketWayNpcAction
-
Following constants has been removed:
UNRELIABLEUNRELIABLE_SEQUENCEDRELIABLERELIABLE_SEQUENCEDRELIABLE_ORDERED
- All functions and events that returned/passed a
nullin the Squirrel, now passes an empty string. Most notable in this list are all equipment related functions and eventsonPlayerEquipAmuletonPlayerEquipArmoronPlayerEquipBeltonPlayerEquipHandItemonPlayerEquipHelmetonPlayerEquipMeleeWeapononPlayerEquipRangedWeapononPlayerEquipRingonPlayerEquipShieldonPlayerEquipSpellgetPlayerAmuletgetPlayerArmorgetPlayerBeltgetPlayerHelmetgetPlayerMeleeWeapongetPlayerRangedWeapongetPlayerRinggetPlayerShieldgetPlayerSpell