|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Development::Feature Requests Post suggestions/feature requests here. |
07-06-2009, 12:08 AM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
Variation for #showstats
As you know #showstats allows you to see exact server stats for player or npc. Some servers even allowed this command to be used by players in order to find out their own exact stats or their pets. (/pet report just doesn't give much info)
I do want players to be able to see own or exact pet stats, but I realy do not want them to use this command to look at mobs or other players.
Is it posible to make a minor version of this command which can ONLY be used on self or own pet? Like #mystats - give players stat when player targets self, or pet's stats if pet is targeted, but will not give any info if you target other players, other player's pets, or mobs.
What you think?
|
07-06-2009, 01:27 AM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
Should be pretty easy to do. Just copy the #showstats command, but add 2 checks: 1 to see if the target is your pet, and another to see if your target is you. If not, it will default to you.
Here's the current #showstats command code from zone/command.cpp:
Code:
void command_showstats(Client *c, const Seperator *sep)
{
if (c->GetTarget() != 0 )
c->GetTarget()->ShowStats(c);
else
c->ShowStats(c);
}
You can change the first if statement to check if the target is your pet (not sure what the function is off the top of my head, something like IsPet()). The else should be able to stay the same.
Methinks this might be a good time to learn you some coding
|
07-06-2009, 01:43 AM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
Hey you are the briliant coder, I am just the ideas generator =P
One day I will actualy sit down and start looking at the source... but it will be a while before I get there - I am desperatly trying to complite my custom DB content first.
Plus I am hoping to convince you guys to make this part of official code (not just a custom insert)
|
07-06-2009, 02:44 AM
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
Quote:
Originally Posted by ChaosSlayerZ
Hey you are the briliant coder
|
Now I dunno about all that...
But seriously, this is a pretty straightforward change (basically just need to dig through the code a bit, which is a heck of a lot easier to do with Visual Studio), so I think it would be a good chance to get your feet wet. Plus, it should help with learning how to do (at the least) some of the small tweaks.
That, and I'm feeling kinda lazy right now
|
07-06-2009, 05:22 PM
|
Sarnak
|
|
Join Date: Oct 2008
Location: USA
Posts: 92
|
|
I was thinking about this the other day for my server as well. I'm not a coder either but I figured I'd give something simple like this a shot. This is what I came up with, I'm not sure if I have the checks right...but I figure it should be in the ballpark. Let me know if it looks ok, I can't compile and test it just yet.
Code:
command_add("mystats","- Show details about you or your pet",50,command_mystats) ||
Code:
void command_mystats(Client *c, const Seperator *sep)
{
if (c->GetTarget() != 0 )
c->GetTarget()->IsPet()->IsClient()->ShowStats(c);
else if (!c->GetTarget()->IsClient()->IsPet())
c->Message(0, "This command only works on players and pets.");
else
c->ShowStats(c);
}
|
|
|
|
07-06-2009, 09:01 PM
|
Sarnak
|
|
Join Date: Oct 2008
Location: USA
Posts: 92
|
|
Yeah, so that definitely didn't work. I figured it out though. Not bad for my first attempt at doing anything with the code. However, as far as keeping it to your own stats I couldn't figure out how to do that. This atleast allows it to only work on clients and pets, which for me is the biggest thing.
SQL:
Code:
INSERT INTO commands VALUES ('mystats', '0', 'Allows player to view pet and client stats, but not npc');
File changes:
Code:
command.h
---------------
ADD
void command_mystats(Client *c, const Seperator *sep);
AFTER
void command_showstats(Client *c, const Seperator *sep);
Code:
command.cpp
----------------
ADD
command_add("mystats","- Show details about you or your pet",50,command_mystats) ||
AFTER
command_add("showstats","- Show details about you or your target",50,command_showstats) ||
ADD
void command_mystats(Client *c, const Seperator *sep)
{
if (c->GetTarget() != 0 )
if (c->GetTarget()->IsClient())
c->GetTarget()->ShowStats(c);
else if (c->GetTarget()->IsPet())
c->GetTarget()->ShowStats(c);
else
c->ShowStats(c);
}
AFTER
void command_showstats(Client *c, const Seperator *sep)
{
if (c->GetTarget() != 0 )
c->GetTarget()->ShowStats(c);
else
c->ShowStats(c);
}
|
|
|
|
07-06-2009, 09:57 PM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
nice =)
I hope this will make it into the main source
|
07-10-2009, 06:36 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
I added this into R762 on the SVN. I made a slight modification to it so that it only works on the client itself or on it's own pet and nothing else. Seems to work just fine now.
Code:
void command_mystats(Client *c, const Seperator *sep)
{
if (c->GetTarget() && c->GetPet()) {
if (c->GetTarget()->IsPet() && c->GetTarget() == c->GetPet())
c->GetTarget()->ShowStats(c);
else
c->ShowStats(c);
}
else
c->ShowStats(c);
}
Thanks for bringing this up, as it is something I have been meaning to add for a while, and just hadn't looked into adding yet. ChaosSlayer was bugging me about it, so I spent a couple minutes looking into it and it was quite simple and quick to do :P
|
07-10-2009, 09:40 AM
|
|
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
hey, technicly I wasn't bugging you - I seduced you on the very fist atempt =P
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:23 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|