Raised This Month: $32 Target: $400
 8% 

MethodMap for TF2Items API


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nergal
Veteran Member
Join Date: Apr 2012
Old 07-08-2015 , 12:08   MethodMap for TF2Items API
Reply With Quote #1

I do not know if Ash has already made methodmaps for tf2items but here's a custom made one since tf2items utilizes handles

PHP Code:
methodmap TF2Item Handle 

    
// C O N S T R U C T O R =============================================================== 
    
public TF2Item(int iFlags
    { 
        return 
view_as<TF2Item>( TF2Items_CreateItem(iFlags) ); 
    } 
    
// ===================================================================================== 
 
    // P R O P E R T I E S ================================================================= 
    
property int Flags 
    

        public 
get() { return TF2Items_GetFlags(this); } 
        public 
setint iFlags ) { TF2Items_SetFlags(thisiFlags); } 
    } 
 
    
property int ItemIndex 
    

        public 
get() {return TF2Items_GetItemIndex(this);} 
        public 
setint iItemDefIndex ) {TF2Items_SetItemIndex(thisiItemDefIndex);} 
    } 
 
    
property int Quality 
    

        public 
get() {return TF2Items_GetQuality(this);} 
        public 
setint iEntityQuality ) {TF2Items_SetQuality(thisiEntityQuality);} 
    } 
 
    
property int Level 
    

        public 
get() {return TF2Items_GetLevel(this);} 
        public 
setint iEntityLevel ) {TF2Items_SetLevel(thisiEntityLevel);} 
    } 
 
    
property int NumAttribs 
    

        public 
get() {return TF2Items_GetNumAttributes(this);} 
        public 
setint iNumAttributes ) {TF2Items_SetNumAttributes(thisiNumAttributes);} 
    } 
    
//======================================================================================= 
 
    
public int GiveNamedItem(int iClient
    { 
        return 
TF2Items_GiveNamedItem(iClientthis); 
    } 
 
    public 
void SetClassname(char[] strClassName
    { 
        
TF2Items_SetClassname(thisstrClassName); 
    } 
 
    public 
void GetClassname(char[] strDestint iDestSize
    { 
        
TF2Items_GetClassname(thisstrDestiDestSize); 
    } 
 
    public 
void SetAttribute(int iSlotIndexint iAttribDefIndexfloat flValue
    { 
        
TF2Items_SetAttribute(thisiSlotIndexiAttribDefIndexflValue); 
    } 
 
    public 
int GetAttribID(int iSlotIndex
    { 
        return 
TF2Items_GetAttributeId(thisiSlotIndex); 
    } 
 
    public 
float GetAttribValue(int iSlotIndex
    { 
        return 
TF2Items_GetAttributeValue(thisiSlotIndex); 
    } 
}; 
How to use!

PHP Code:
    TF2Item hWep = new TF2Item(OVERRIDE_ALL|PRESERVE_ATTRIBUTES|FORCE_GENERATION);
    
hWep.SetClassname("tf_weapon_example"); 
    
hWep.Quality 6
    
hWep.Level 1
    
hWep.NumAttribs 0;
    
delete hWep
__________________

Last edited by nergal; 11-11-2015 at 09:53.
nergal is offline
Zeusington
Junior Member
Join Date: Aug 2015
Old 08-12-2015 , 15:44   Re: MethodMap for TF2Items API
Reply With Quote #2

I was already using a methodmap for this, but I think I'll lift yours. OOP syntax is so much cleaner.
Zeusington is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 11-10-2015 , 23:58   Re: MethodMap for TF2Items API
Reply With Quote #3

Hey Asher, can I get this stickied?
__________________
nergal is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 11-11-2015 , 09:44   Re: MethodMap for TF2Items API
Reply With Quote #4

I think TF2Item would be a better methodmap name then TF2Items
WildCard65 is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 11-11-2015 , 09:53   Re: MethodMap for TF2Items API
Reply With Quote #5

Quote:
Originally Posted by WildCard65 View Post
I think TF2Item would be a better methodmap name then TF2Items
done ^^
__________________
nergal is offline
humbugtheman
Member
Join Date: Jan 2012
Old 02-16-2016 , 04:54   Re: MethodMap for TF2Items API
Reply With Quote #6

Thanks for this!
humbugtheman is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 02-16-2016 , 11:28   Re: MethodMap for TF2Items API
Reply With Quote #7

Quote:
Originally Posted by humbugtheman View Post
Thanks for this!
no problem ^^
__________________
nergal is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode