collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Updated - Crafting Module  (Read 14537 times)

0 Members and 2 Guests are viewing this topic.

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Updated - Crafting Module
« on: July 19, 2008, 03:28:54 am »
Hi,

I've made the craft tracking module a little more user friendly. Specifically, it now

  • Checks 2 crafts have actually been entered and if not informs the user they need to set both at the same time
  • Checks that the crafts are the correct types and if not informs the user what valid crafts are
  • Parses the input and formats it correctly for the SQL code which forces uppercase first letter so it wont fail because of case sensitivity

It might not be the most elegant way of doing it but for my first ever bit of PHP or indeed coding whatsoever I'm quite happy with it.

Buffarse

Offline Sigi_cz

  • BeBot Rookie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #1 on: July 28, 2008, 08:45:28 pm »
thanks. good to have this, because gmembers often set only one craft and then it is not working properly

Offline Organizer

  • BeBot Apprentice
  • ***
  • Posts: 135
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #2 on: July 29, 2008, 11:52:36 am »
Thanks, hopefully this can be added to the core pack...

Offline Lightwave

  • BeBot Rookie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #3 on: July 31, 2008, 09:00:02 pm »
My coding ability is rather poor so I'm hesitant to publish changes I've made...
but I made a minor change adding in a "None" type to the class1, class2 enum so people with zero or one profession/s can still add info, or availability if there's a need for more people to do a certain thing.

Also, I added class1_tier, class2_tier ints so people can register their tier proficiency as well.  eg setcraft Weaponsmith 5 Armorsmith 5.

Next step will be to add in settings for resource gathering tier capabilities, and then an easier way to search for a crafter of a certain type.  (But, someone better, could probably do this before me :p )

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #4 on: July 31, 2008, 09:58:23 pm »
Hehe well one of those changes was on my to-do list too ;)

I wanted to to add the ability to do !craftingclass all to show a complete list but I got stuck when  had the time producing a windowed list (I think I can do it now) and also a !craftingclass Armoursmith which would list all of them.

:)

Post your changes though, it's what I did. Worst you'll get is some friendly person improving it or correcting it. Remember I'd never touched code in my life before making my change. We all have to start somewhere :)

Buff

Offline Lightwave

  • BeBot Rookie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #5 on: July 31, 2008, 10:14:36 pm »
Yeah ok...

I changed around the wording a bit from the text things too, and figured some people might not care for that.

Offline Sigi_cz

  • BeBot Rookie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #6 on: August 01, 2008, 09:19:06 am »
Thanks for yout work guys but it seems that it does not update info in DB with new values.

I had modified a bit the help system for those commands. File is attached.

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #7 on: August 01, 2008, 10:41:50 am »
I'm off for a few days unfortunately and hardly an expert but my guess is that if the table already exists, it wont execute the code that sets up the class_tier fields because it only executes if theres no existing table. Unless we drop  table first (which is jut not desirable as it wipes all the existing info) we need to update the table with those fields.

Don't have the time to look at fixing it (if indeed that is the problem) but it's an idea.

Cheers

Buff

Offline Sigi_cz

  • BeBot Rookie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #8 on: August 01, 2008, 11:17:36 am »
Lightwawe's code should do update
Code: [Select]
$this -> bot -> db -> query('INSERT INTO #___craftingclass (name,class1,class1_tier,class2,class2_tier) VALUES("'.$name.'","'.$options[0].'","'.$options[1].'","'.$options[2].'","'.$options[3].'") ON DUPLICATE KEY UPDATE class1=values(class1), class1_tier=values(class1_tier), class2=values(class2), class2_tier=values(class2_tier)');

Offline Lightwave

  • BeBot Rookie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #9 on: August 01, 2008, 01:56:47 pm »
I'm still a bit confused... the line you pasted seems to be exactly what my file already had?

Offline Sigi_cz

  • BeBot Rookie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #10 on: August 01, 2008, 02:58:43 pm »
I'm still a bit confused... the line you pasted seems to be exactly what my file already had?
yes it is your code. it was ansver to GBH.

still. why it is not working? :)

Offline Lightwave

  • BeBot Rookie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #11 on: August 01, 2008, 04:08:41 pm »
Where are you not seeing the info update?  !whois or !craft

!whois uses cached information and won't update as quickly as !craft which should show an immediate change.

Offline Sigi_cz

  • BeBot Rookie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #12 on: August 01, 2008, 05:04:18 pm »
Where are you not seeing the info update?  !whois or !craft
!craft. I had Alchemist and Gemcutter. now I tried Alchemist 1 Gemcutter 3 and !craft showed me only craft names and not tiers. Then i tried Weaponspith 1 Armorsmith 1, and craft showed up Alchemist and gemcutter without tiers again.

Offline Lightwave

  • BeBot Rookie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Updated - Crafting Module
« Reply #13 on: August 01, 2008, 06:10:41 pm »
Sounds like you didn't update your database as GBH mentioned.

You either need to delete the craftingclass table, or manually add in the class1_tier, class2_tier columns to the table.

You should be getting a reply when you send the message to the bot saying "Thank you for updating your crafting information."  I'm guessing you don't?

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 440
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal