Raised This Month: $12 Target: $400
 3% 

ID for unusual particles [Updated 11/07/2014]


Post New Thread Reply   
 
Thread Tools Display Modes
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 05-21-2013 , 18:16   Re: ID for unusual particles [Updated 12/24/2012]
Reply With Quote #11

Quote:
Originally Posted by Powerlord View Post
You can also view the schema XML online (Note: That's the OpTF2 mirror of the schema, you have to use the IEconItems GetSchema API to get it directly).
I have been parsing items game to get slots for items.. Is it a hat,misc, primary, secondary, melee... But its a pita because it is constantly changed. It would probably be better to do something like cache a schema like this so i could get the index and slot, and then read from that.

Does anything like this already exist? If not i might go and write it. I am tired of dealing with items_game.

I can't get the api to return anything other than unauthorized, so i must be doing it wrong.

Edit: looks like I need a key, which can only be used once, or once every so often, how do i get them, so that I can generate the file?
http://api.steampowered.com/IEconIte...XXXXXXXXXXXXXX
Edit Edit: i'm dumb https://steamcommunity.com/login/hom...2Fdev%2Fapikey

okay i think i'm going to develop a plugin use the web api.

native to return a slot when given definition index
native to return if item is paintable when given definition index
native to return name of item

will probably use VDF and just cache the file every map start, if it fails, i'll use the old file, if success i'll update an item trie.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 05-21-2013 at 19:31.
friagram is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-21-2013 , 21:33   Re: ID for unusual particles [Updated 12/24/2012]
Reply With Quote #12

Quote:
Originally Posted by friagram View Post
I have been parsing items game to get slots for items.. Is it a hat,misc, primary, secondary, melee... But its a pita because it is constantly changed. It would probably be better to do something like cache a schema like this so i could get the index and slot, and then read from that.

Does anything like this already exist? If not i might go and write it. I am tired of dealing with items_game.

I can't get the api to return anything other than unauthorized, so i must be doing it wrong.

Edit: looks like I need a key, which can only be used once, or once every so often, how do i get them, so that I can generate the file?
http://api.steampowered.com/IEconIte...XXXXXXXXXXXXXX
Edit Edit: i'm dumb https://steamcommunity.com/login/hom...2Fdev%2Fapikey

okay i think i'm going to develop a plugin use the web api.

native to return a slot when given definition index
native to return if item is paintable when given definition index
native to return name of item

will probably use VDF and just cache the file every map start, if it fails, i'll use the old file, if success i'll update an item trie.
https://forums.alliedmods.net/showthread.php?p=1689522
__________________
asherkin is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-21-2013 , 22:19   Re: ID for unusual particles [Updated 5/21/2013]
Reply With Quote #13

I thought about writing a script that would parse the schema into a database and then have commands like the plugin Asherkin linked so that items_game doesn't have to be parsed every single time.

Except I'm busy with other things.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 05-21-2013 , 23:10   Re: ID for unusual particles [Updated 5/21/2013]
Reply With Quote #14

As stated earlier. items_game has problems, and it doesn't parse very easily. The schema is a lot better.
I got it working. The item definition index is the key for the tries, i have one for name, paint, and another for slot.

L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Plug-In Prospector slot:1 paint:0
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Rusty Reaper slot:2 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:Soldier's Sparkplug slot:2 paint:0
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Bolted Bicorne slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Timeless Topper slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Filamental slot:2 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Strontium Stove Pipe slot:1 paint:0
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:Firewall Helmet slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:Respectless Robo-Glove slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] nameyro's Boron Beanie slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:Halogen Head Lamp slot:1 paint:0
L 05/21/2013 - 20:06:55: [itemsapi.smx] namelatinum Pickelhaube slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Virus Doctor slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:Texas Tin-Gallon slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:Titanium Tyrolean slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] nameractitioner's Processing Mask slot:2 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:Bootleg Base Metal Billycock slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:Mecha-Medes slot:2 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Tungsten Toque slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Steam Pipe slot:2 paint:0
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Data Mining Light slot:1 paint:0
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Byte'd Beak slot:2 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Googol Glass Eyes slot:2 paint:0
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Bunsen Brave slot:1 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Scrumpy Strongbox slot:2 paint:1
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Dual-Core Devil Doll slot:2 paint:0
L 05/21/2013 - 20:06:55: [itemsapi.smx] name:The Bolted Birdcage slot:1 paint:1

How would I go about making it automatically update when this happens, or should I bother or just set a time.
Right now it caches the file (it's 2 megs) and then updates it if it doesn't fail the http query.

The item server is shutting down. Items will be unavailable temporarily.
Connection to game coordinator established.
Received 1730611 bytes item schema version E65582FD direct data; update is queue
d.


Not sure what the best way to go about this is, i could probably make some functions like, is hat, is weapon, or make it so gt/lt classifies more easily, but it's just as easy to grab the type and compare:

enum TFAPISlotType
{
unknown=0, // items will never be put in this category, but it may have uses
head, // this is the most important item class, so it comes first
misc,
action,
primary,
secondary,
melee,
building,
pda,
pda2,
};

so for example, <= 2 would be a wearable, >= 4 would be a weapon

mabye there's a better way to do the classifications, i have no idea.

Edit: I think this will work ok.
I put a cvar to enter API key and time to refresh schema in minutes, which checks the cached file's last update time.

The unknown type is returned when the item definition index is invalid (not in the trie).
I already found a use for this .. say searching for tf_wearables that are on a player, but don't have a given slot (weapon wearables) like razorback, etc. They will be found with the unknown index.. I think. Going to test it in a few.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 05-22-2013 at 02:56.
friagram is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 05-22-2013 , 06:31   Re: ID for unusual particles [Updated 5/21/2013]
Reply With Quote #15

So far I have this, and it's working:

PHP Code:
enum TFiaSlotType
{
    
TFia_Slot_unknown=0,                // items will never be put in this category, but it may have uses
    
TFia_Slot_head,                    // this is the most important item class, so it comes first :)
    
TFia_Slot_misc,    
    
TFia_Slot_action,
    
TFia_Slot_primary,
    
TFia_Slot_secondary,
    
TFia_Slot_melee,
    
TFia_Slot_building,
    
TFia_Slot_pda,
    
TFia_Slot_pda2,
    
TFia_Slot_wearable,                // items will never be put in this category, but it may overriden to this category (ItemsApi_GetSlotEx)
};

/**
 * Returns true if the items schema is cached and available
 *
**/
native bool:ItemsApi_Ready();


/**
 * Returns the item equip slot of an item, unknown on failure
 *
 * @param num1    An Item Definition Index
**/
native TFiaSlotType:ItemsApi_GetSlot(index);


/**
 * Returns the item equip slot of an item, unknown on failure
 * Use this to filter out "tf_wearable" items which may be returned as weapons otherwise (items like the razorback or buff banner)
 *
 * @param num1    An Item Definition Index
 * @param num2    A TFiaSlotType to override the return slot index if it is a "tf_werable" but not a TFia_Slot_head or TFia_Slot_misc type (usually a weapon wearable)
**/
native TFiaSlotType:ItemsApi_GetSlotEx(indexTFiaSlotType:weapon_wearable TFia_Slot_wearable);


/**
 * Returns true if an item is paintable
 *
 * @param num1    An Item Definition Index
**/
native bool:ItemsApi_Paintable(index);

/**
 * Returns true if an item is wearable (tf_wearable)
 *
 * @param num1    An Item Definition Index
**/
native bool:ItemsApi_Wearable(index);

/**
 * Returns length of string written to buffer, 0 on failure.
 *
 * @param num1    An Item Definition Index
 * @param num2    buffer to write item name.
**/
native ItemsApi_GetName(indexString:name[]); 
there are however, still a few bugs to work out.
this should be better....

Edit. This idea moved here https://forums.alliedmods.net/showthread.php?t=216573
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 05-24-2013 at 18:54.
friagram is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-24-2013 , 15:05   Re: ID for unusual particles [Updated 5/21/2013]
Reply With Quote #16

It kinda bugs me that you added the new particle IDs, but got their names wrong

They should be:
63 - Phosphorous
64 - Sulphurous
65 - Memory Leak
66 - Overclocked
67 - Electrostatic
68 - Power Surge
69 - Anti-Freeze
70 - Time Warp
71 - Green Black Hole
72 - Roboactive
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 05-24-2013 , 18:52   Re: ID for unusual particles [Updated 5/21/2013]
Reply With Quote #17

Quote:
Originally Posted by Powerlord View Post
It kinda bugs me that you added the new particle IDs, but got their names wrong

They should be:
63 - Phosphorous
64 - Sulphurous
65 - Memory Leak
66 - Overclocked
67 - Electrostatic
68 - Power Surge
69 - Anti-Freeze
70 - Time Warp
71 - Green Black Hole
72 - Roboactive
No pl, all the names in that plugin are straight from items_game.. Lol
Oh, my mistake. The plugin that this post was made for, uses items game names.
Even still a lot of those names are wrong... The earlier ones.
:/
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 05-24-2013 at 19:02.
friagram is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-24-2013 , 22:47   Re: ID for unusual particles [Updated 5/21/2013]
Reply With Quote #18

Quote:
Originally Posted by friagram View Post
No pl, all the names in that plugin are straight from items_game.. Lol
Oh, my mistake. The plugin that this post was made for, uses items game names.
Even still a lot of those names are wrong... The earlier ones.
:/
The ones I quoted are taken directly from tf_english.txt.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 05-27-2013 , 05:57   Re: ID for unusual particles [Updated 5/21/2013]
Reply With Quote #19

Quote:
Originally Posted by Powerlord View Post
The ones I quoted are taken directly from tf_english.txt.
Not you, https://forums.alliedmods.net/showpo...63&postcount=1
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
VintageEpicFail
Senior Member
Join Date: Feb 2012
Location: Straya
Old 07-17-2013 , 01:35   Re: ID for unusual particles [Updated 5/21/2013]
Reply With Quote #20

When will the new effects be up?
VintageEpicFail 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 07:44.


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