Auto-squelch add-on and some questions

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
LinaButterfly
Yeek
Posts: 11
Joined: Wed Sep 18, 2013 7:38 am

Auto-squelch add-on and some questions

#1 Post by LinaButterfly »

Hello everyone,

I've searched for an addon that helps with loot management by auto transmogrifying certain types of loot depending on player choice. For example, a brawler might want to automatically transmog all massive armour to have a less cluttered transmog chest at the end of level to sort through. Surprisingly, I couldn't find anything. So I guess my first question is: is there such an addon that I just missed?

Anyway, I thought I'd make one just as an exercise, and to get to understand the t-engine a bit better. The way I see it working is: a player can invoke a dialog which presents them with a tabbed interface. Every type of item (e.g. dagger, massive armour, cloth hat) has a bunch of checkboxes representing different rarities. the player then checks the boxes for the items they want to get rid of and thus can get rid of , say, all staves and all gloves that are not purple or better.

I have a few questions and am hoping that someone might offer some help, so here goes:

1- How to give the player this ability. I can think of three approaches and would appreciate some advice:
  • a- Give players an item which can be activated to bring up the dialog. How do I go about doing that? I guess I can do that in Player:onBirth(), but what if I wanted to give the item to characters that were generated without it. Which functions are responsible for initiating a new game "session"
    b- Give players a talent that invokes the dialog. I noticed the following line in Actor:Init()

    Code: Select all

    self.talents[self.T_ATTACK] = self.talents[self.T_ATTACK] or 1
    However, I didn't find anything in the Attack talent code that linked it to "T_ATTACK". Does the game internally create this identifier by uppercasing the talent name and prefixing it with "T_"? So if my talent definition included the line

    Code: Select all

    name = "Autosquelch",
    will the game automatically create the identifier "T_AUTOSQUELCH"?
    c- I've looked at Zizzo's Point Planner addon and he just binds a function to a key. This seems like the cleanest solution and I'll probably go with it. Still, I would like to know the answers to my questions for the first two options, just out of curiosity.
2- When to activate Autosquelch:
  • a- Whenever the player acts. I can add something to Player:Act() but I'm afraid that will slow the game down if it had to go through the player's inventory every time they performed an action.
    b- Whenever the player picks up an item. I can't seem to find the appropriate function to superload. I found references to Player:pickupFloor() but couldn't track down the function definition in either player.lua or actor.lua. Also I'm afraid of using this approach in case some code in the pickup process (either internal or from another addon) tries to do something to an object which I just destroyed, and ends up with a nil reference or something.
    c- Once every X turns. Seems a bit inelegant to me.
3- How to save user preferences: This isn't really important and I will be perfectly satisfied if the player had to re-choose their auto-squelch settings once per session. Still, it would be a nice feature. So, can someone direct me to an addon that directly interacts with character loading/saving?

Lastly, will any of this adversely affect character status (e.g. mark them as cheater or disallow entry to the ladder or something?)

Thank you for your time.

LinaButterfly
Yeek
Posts: 11
Joined: Wed Sep 18, 2013 7:38 am

Re: Auto-squelch add-on and some questions

#2 Post by LinaButterfly »

Hi,

the addon has been released. this is a link to the release post: http://forums.te4.org/viewtopic.php?f=50&t=38856

Post Reply