ArcEmu: Rev 3127 Easy-wrappers - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Rev 3127 Easy-wrappers

#1 User is offline   hypersniper 

  • Advanced Member
  • Group: Retired
  • Posts: 227
  • Joined: 21-November 08
  • Gender:Male

Posted 24 January 2010 - 05:11 PM

In Rev 3127 I did a big cleanup, adding wrappers to almost all of the update fields. You should use these wrappers rather than SetUInt32Value, etc. :P

Title: Easy wrappers
Details:
Container:
void SetNumSlots(uint32 num) { SetUInt32Value(CONTAINER_FIELD_NUM_SLOTS, num); }
uint32 GetNumSlots() { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
void SetSlot(uint16 slot, uint64 guid) { SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), guid); }
uint64 GetSlot(uint16 slot) { return GetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2)); }

Corpse:
void SetOwner( uint64 guid ) { SetUInt64Value(CORPSE_FIELD_OWNER, guid); }
uint64 GetOwner() { return GetUInt64Value(CORPSE_FIELD_OWNER); }
	
void SetDisplayId( uint32 id ) { SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, id); }
uint32 GetDisplayId() { return GetUInt32Value(CORPSE_FIELD_DISPLAY_ID); }

Unit:
void setLevel(uint32 level) { SetUInt32Value(UNIT_FIELD_LEVEL, level); };
void modLevel(int32 mod) { ModUnsigned32Value(UNIT_FIELD_LEVEL, mod); };
uint32 GetFaction() { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); }
void SetEquippedItem( uint8 slot, uint32 id ) { SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+slot, id); }
uint32 GetEquippedItem( uint8 slot ) { return GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+slot); }

void SetBaseAttackTime( uint8 slot, uint32 time ) { SetUInt32Value(UNIT_FIELD_BASEATTACKTIME+slot, time); }
uint32 GetBaseAttackTime( uint8 slot ) { return GetUInt32Value(UNIT_FIELD_BASEATTACKTIME+slot); }
void ModBaseAttackTime( uint8 slot, int32 mod ) { ModUnsigned32Value(UNIT_FIELD_BASEATTACKTIME+slot, mod); }

void SetBoundingRadius( float rad ) { SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, rad); }
float GetBoundingRadius() { return GetFloatValue(UNIT_FIELD_BOUNDINGRADIUS); }

void SetCombatReach( float len ) { SetFloatValue(UNIT_FIELD_COMBATREACH, len); }
float GetCombatReach() { return GetFloatValue(UNIT_FIELD_COMBATREACH); }

void SetDisplayId( uint32 id ) { SetUInt32Value(UNIT_FIELD_DISPLAYID, id); }
uint32 GetDisplayId() { return GetUInt32Value(UNIT_FIELD_DISPLAYID); }

void SetNativeDisplayId( uint32 id ) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, id); }
uint32 GetNativeDisplayId() { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); }

void SetMinDamage( float amt ) { SetFloatValue(UNIT_FIELD_MINDAMAGE, amt); }
float GetMinDamage() { return GetFloatValue(UNIT_FIELD_MINDAMAGE); }

void SetMaxDamage( float amt ) { SetFloatValue(UNIT_FIELD_MAXDAMAGE, amt); }
float GetMaxDamage() { return GetFloatValue(UNIT_FIELD_MAXDAMAGE); }

void SetMinOffhandDamage( float amt ) { SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, amt); }
float GetMinOffhandDamage() { return GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE); }

void SetMaxOffhandDamage( float amt ) { SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, amt); }
float GetMaxOffhandDamage() { return GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE); }

void SetMinRangedDamage( float amt ) { SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE, amt); }
float GetMinRangedDamage() { return GetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE); }

void SetMaxRangedDamage( float amt ) { SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE, amt); }
float GetMaxRangedDamage() { return GetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE); }

void SetMount( uint32 id ) { SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, id); }
uint32 GetMount() { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); }

void SetCastSpeedMod( float amt ) { SetFloatValue(UNIT_MOD_CAST_SPEED, amt); }
float GetCastSpeedMod() { return GetFloatValue(UNIT_MOD_CAST_SPEED); }
void ModCastSpeedMod( float mod ) { ModFloatValue(UNIT_MOD_CAST_SPEED, mod); }

void SetCreatedBySpell( uint32 id ) { SetUInt32Value(UNIT_CREATED_BY_SPELL, id); }
uint32 GetCreatedBySpell() { return GetUInt32Value(UNIT_CREATED_BY_SPELL); }

void SetEmoteState( uint32 id ) { SetUInt32Value(UNIT_NPC_EMOTESTATE, id); }
uint32 GetEmoteState() { return GetUInt32Value(UNIT_NPC_EMOTESTATE); }

void SetStat( uint32 stat, uint32 amt ) { SetUInt32Value(UNIT_FIELD_STAT0+stat, amt); }
uint32 GetStat( uint32 stat ) { return GetUInt32Value(UNIT_FIELD_STAT0+stat); }

void SetResistance( uint32 type, uint32 amt ) { SetUInt32Value(UNIT_FIELD_RESISTANCES+type, amt); }
uint32 GetResistance( uint32 type ) { return GetUInt32Value(UNIT_FIELD_RESISTANCES+type); }

void SetBaseMana( uint32 amt ) { SetUInt32Value(UNIT_FIELD_BASE_MANA, amt); }
uint32 GetBaseMana() { return GetUInt32Value(UNIT_FIELD_BASE_MANA); }

void SetBaseHealth( uint32 amt ) { SetUInt32Value(UNIT_FIELD_BASE_HEALTH, amt); }
uint32 GetBaseHealth() { return GetUInt32Value(UNIT_FIELD_BASE_HEALTH); }

void SetPowerCostMultiplier( uint32 school, float amt ) { SetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+school, amt); }
void ModPowerCostMultiplier( uint32 school, float amt ) { ModFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+school, amt); }
float GetPowerCostMultiplier( uint32 school ) { return GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+school); }

void SetAttackPower( uint32 amt ) { SetUInt32Value(UNIT_FIELD_ATTACK_POWER, amt); }
uint32 GetAttackPower() { return GetUInt32Value(UNIT_FIELD_ATTACK_POWER); }

void SetAttackPowerMods( uint32 amt ) { SetUInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, amt); }
uint32 GetAttackPowerMods() { return GetUInt32Value(UNIT_FIELD_ATTACK_POWER_MODS); }
void ModAttackPowerMods( uint32 amt ) { ModUnsigned32Value(UNIT_FIELD_ATTACK_POWER_MODS, amt); }

void SetAttackPowerMultiplier( float amt ) { SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, amt); }
float GetAttackPowerMultiplier() { return GetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER); }
void ModAttackPowerMultiplier( float amt ) { ModFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, amt); }

void SetRangedAttackPower( uint32 amt ) { SetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER, amt); }
uint32 GetRangedAttackPower() { return GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER); }

void SetRangedAttackPowerMods( uint32 amt ) { SetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS, amt); }
uint32 GetRangedAttackPowerMods() { return GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS); }
void ModRangedAttackPowerMods( uint32 amt ) { ModUnsigned32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS, amt); }

void SetRangedAttackPowerMultiplier( float amt ) { SetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER, amt); }
float GetRangedAttackPowerMultiplier() { return GetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER); }
void ModRangedAttackPowerMultiplier( float amt ) { ModFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER, amt); }

void ModHealth( int32 val ) { ModUnsigned32Value( UNIT_FIELD_HEALTH, val ); }
void ModMaxHealth( int32 val ) { ModUnsigned32Value( UNIT_FIELD_MAXHEALTH, val ); }

Player:
void	SetDuelArbiter( uint64 guid ) { SetUInt64Value(PLAYER_DUEL_ARBITER, guid); }
uint64	GetDuelArbiter() { return GetUInt64Value(PLAYER_DUEL_ARBITER); }
void	SetDuelTeam( uint32 team ) { SetUInt32Value(PLAYER_DUEL_TEAM, team); }
uint32	GetDuelTeam() { return GetUInt32Value(PLAYER_DUEL_TEAM); }
int32 GetVisibleBase( int16 slot ) { return (PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * PLAYER_VISIBLE_ITEM_LENGTH)); }
void SetChosenTitle( uint32 id ) { SetUInt32Value(PLAYER_CHOSEN_TITLE, id); }

void SetInventorySlot( uint32 slot, uint64 guid ) { SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), guid); }

void SetFarsightTarget( uint64 guid ) { SetUInt64Value(PLAYER_FARSIGHT, guid); }
uint64 GetFarsightTarget() { return GetUInt64Value(PLAYER_FARSIGHT); }

void SetXp( uint32 xp ) { SetUInt32Value(PLAYER_XP, xp); }
uint32 GetXp() { return GetUInt32Value(PLAYER_XP); }
void SetNextLevelXp( uint32 xp ) { SetUInt32Value(PLAYER_NEXT_LEVEL_XP, xp); }

void SetTalentPoints( uint8 spec, uint32 amt ) { SetUInt32Value(PLAYER_CHARACTER_POINTS1+spec, amt); }
void ModTalentPoints( uint8 spec, int32 amt ) { ModUnsigned32Value(PLAYER_CHARACTER_POINTS1+spec, amt); }
uint32 GetTalentPoints( uint8 spec ) { return GetUInt32Value(PLAYER_CHARACTER_POINTS1+spec); }

void ModPosDamageDoneMod( uint32 school, uint32 value ) { ModUnsigned32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+school, value); }
uint32 GetPosDamageDoneMod( uint32 school ) { return GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+school); }

void ModNegDamageDoneMod( uint32 school, uint32 value ) { ModUnsigned32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+school, value); }
uint32 GetNegDamageDoneMod( uint32 school ) { return GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+school); }

void ModHealingDoneMod( uint32 value ) { SetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, value); }
uint32 GetHealingDoneMod() { return GetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS); }

void SetAmmoId( uint32 id ) { SetUInt32Value(PLAYER_AMMO_ID, id); }
uint32 GetAmmoId() { return GetUInt32Value(PLAYER_AMMO_ID); }

void SetHonorCurrency( uint32 value ) { SetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY, value); }
void ModHonorCurrency( uint32 value ) { ModUnsigned32Value(PLAYER_FIELD_HONOR_CURRENCY, value); }
uint32 GetHonorCurrency() { return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY); }

void SetArenaCurrency( uint32 value ) { SetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY, value); }
void ModArenaCurrency( uint32 value ) { ModUnsigned32Value(PLAYER_FIELD_ARENA_CURRENCY, value); }
uint32 GetArenaCurrency() { return GetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY); }

void SetGlyph( uint32 slot, uint32 id ) { SetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot, id); }
uint32 GetGlyph( uint32 slot ) { return GetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot); }

Game object:
void SetDisplayId( uint32 id ) { SetUInt32Value(GAMEOBJECT_DISPLAYID, id); }
uint32 GetDisplayId() { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }

void SetParentRotation( uint8 rot, float value ) { SetFloatValue(GAMEOBJECT_PARENTROTATION+rot, value); }
float GetParentRotation( uint8 rot ) { return GetFloatValue(GAMEOBJECT_PARENTROTATION+rot); }

void SetFaction( uint32 id ) { SetUInt32Value(GAMEOBJECT_FACTION, id); }
uint32 GetFaction() { return GetUInt32Value(GAMEOBJECT_FACTION); }

void SetLevel( uint32 level ) { SetUInt32Value(GAMEOBJECT_LEVEL, level); }
uint32 GetLevel() { return GetUInt32Value(GAMEOBJECT_LEVEL); }

Please don't PM me asking to fix, correct or look-over your scripts. Please post a new thread in the Lua Scripting section so others can learn and help.
0

#2 User is offline   Doggie52 

  • arcemu feedback police
  • PipPipPip
  • Group: Members
  • Posts: 297
  • Joined: 09-October 08
  • Gender:Male
  • Location:Sweden
  • Interests:web designing, web programming, wow databases, game- and webservers
  • Server OS:Windows

Posted 25 January 2010 - 04:18 AM

Beautiful structure - great job!
0

#3 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 28 January 2010 - 09:07 AM

void ModPower( uint32 index, int32 value ){
        ModUnsigned32Value(UNIT_FIELD_POWER1 + index, value);
    }

this is the right wrapper for ModUnsigned32Value(UNIT_FIELD_POWER1 +index, value), since ModUnsigned32Value() doesn't do any check for max/min power. It broke http://www.wowhead.com/?spell=14983 and few other spells trying to change the max power.
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#4 User is offline   Major Cooke 

  • Member
  • Pip
  • Group: Members
  • Posts: 10
  • Joined: 23-October 08

Posted 29 January 2010 - 11:47 AM

Am I to assume these are usable via LUA as well?
0

#5 User is offline   Kirth 

  • Member
  • Pip
  • Group: Members
  • Posts: 72
  • Joined: 13-April 09
  • Gender:Male
  • Location:Candy Mountain
  • Interests:Chaaarlieeee!

Posted 06 April 2010 - 07:57 AM

What's wrong with macros?
0

#6 User is offline   wayland 

  • Member
  • Pip
  • Group: Members
  • Posts: 65
  • Joined: 07-June 08

Posted 06 April 2010 - 08:04 AM

totally useless and gay solution
0

#7 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 12 December 2010 - 02:24 PM

http://sourceforge.n.../changeset/3956
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users