PlaneShift

  • Status Closed
  • Percent Complete
    100%
  • Task Type Feature Request
  • Category
  • Assigned To
    Glen Kaukola
  • Operating System
  • Severity Low
  • Priority
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: PlaneShift
Opened by Caarrie - 05.12.2007
Last edited by Lanarel - 27.11.2009

FS#715 - easier way to setskills

The gms wish for an easier way to setskill, working from the chat window is not always easy if we need many skills changed.

To be able to edit stat and skill levels from withing the GUI

The task blocks this from closing
ID Project Summary Priority Severity Assigned To Progress
1985 PlaneShift FS#1985 - List of all GM feature requests [or dev lvl requests] Low Aresilek Besolez
0%
Closed by  Lanarel
27.11.2009 15:41
Reason for closing:  
Additional comments about closing:  

Fixed by Decker

Thom commented on 05.12.2007 19:07

/setskill me all 200?

Caarrie commented on 05.12.2007 19:18

that does not work if in events we need certain skills at certain lvls

Thom commented on 05.12.2007 23:42

What kind of event would that be? I can’t imagine a situation in a roleplaying event where your skill in sword making needs to be exactly 56 for the event to succeed. I’m not saying make a GUI for this would be bad, just that I don’t see how it would be more effective and really help events.

Besides, if you need a specific set of skills set before an event for some reason, you could always just make a shortcut beforehand. Or don’t multiple /setskill commands in a shortcut work? If so, that’d be a bug, but it’s known already.

A. Kiefner commented on 14.10.2008 22:21

With  FS#2324  and  FS#2378  I don’t think we need skills modifiable via GUI, at least not soon.
However, there came up a suggestion that should be taken into account. For testing and events, it might be good to easily set skills equally of a target like
/setskill me match harnquist
whereas the first argument is whose skills get set, “match” is keyword and second argument is the one whose skills get cloned.

Note: both arguments are regular “target”s

weltall commented on 20.11.2009 06:14

assigning to decker.
implement it like this /setskill [targetdestination] [targetorigin] copy
also /setskill [?argetdestination] copy [targetorigin] might work, probably even better

use targetdestination as a generic target but lock it to same target of issuer or put a validate call to a special permission used just for it to be extended to any target.

Glen Kaukola commented on 21.11.2009 22:07

Here’s what I came up with (from svn diff). Although I’m not sure why you’re asking for a special permission check. There’s already a check in SetSkill to see if the client has “setskill others” access.

Index: src/server/adminmanager.cpp
===================================================================
--- src/server/adminmanager.cpp	(revision 4757)
+++ src/server/adminmanager.cpp	(working copy)
@@ -665,10 +665,15 @@
     {
         player = words[1];
         skill = words[2];
-        if (words.GetCount() >= 4)
+        if (words.GetCount() >= 4 && skill != "copy")
+        {
             value = words.GetInt(3);
+        }
         else
+        {
+            sourceplayer = words[3];
             value = -2;
+        }
         return true;
     }
     else if (command == "/set")
@@ -6518,11 +6523,47 @@
 
 void AdminManager::SetSkill(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData& data, Client* client, gemActor *target)
 {
-    if (data.skill.IsEmpty() || data.value == -2)
+    Client* sourceclient = NULL;
+    gemActor* source = NULL;
+    psCharacter * schar = NULL;
+
+    // Try to find the source of skills if we're doing a copy
+    if (data.skill == "copy")
     {
-        psserver->SendSystemError(me->clientnum, "Syntax: /setskill [target] [skill|'all'] [value|-1]");
-        return;
+        if (data.sourceplayer == "me")
+        {
+            sourceclient = client;
+        }
+        else
+        {
+            sourceclient = FindPlayerClient(data.sourceplayer);
+        }
+
+        if (sourceclient)
+        {
+            source = sourceclient->GetActor();
+            schar = source->GetCharacterData();
+            if (!schar)
+            {
+                psserver->SendSystemError(me->clientnum, "No source character data!");
+                return;
+            }
+        }
+        else
+        {
+            psserver->SendSystemError(me->clientnum, "Syntax: /setskill [target] [skill|'all'] [value|-1] | [target] copy [source]");
+            return;
+        }
     }
+    // Otherwise just proceed as normal
+    else
+    {
+        if (data.skill.IsEmpty() || data.value == -2)
+        {
+            psserver->SendSystemError(me->clientnum, "Syntax: jurg jurg jurg /setskill [target] [skill|'all'] [value|-1] | [target] copy [source]");
+            return;
+        }
+    }
 
     if (target == NULL)
     {
@@ -6603,6 +6644,26 @@
             psserver->SendSystemOK(target->GetClientID(), "All your skills were set to %d by a GM", data.value);
         }
     }
+    else if (data.skill == "copy")
+    {
+        for (int i=0; i<PSSKILL_COUNT; i++)
+        {
+            psSkillInfo * skill = CacheManager::GetSingleton().GetSkillByID(i);
+            if (skill == NULL) continue;
+
+            unsigned int old_value = pchar->Skills().GetSkillRank(skill->id).Current();
+            unsigned int new_value = schar->Skills().GetSkillRank(skill->id).Current();
+
+            pchar->SetSkillRank(skill->id, new_value);
+            psserver->SendSystemInfo(me->clientnum, "Changed '%s' of '%s' from %u to %u", skill->name.GetDataSafe(), target->GetName(), old_value, new_value);
+
+            if (target->GetClient() &&  target->GetClient() != client)
+            {
+                // Inform the other player.
+                psserver->SendSystemOK(target->GetClientID(), "Your '%s' level was set to %d by a GM", data.skill.GetDataSafe(), new_value);
+            }
+        }
+    }
     else
     {
         psSkillInfo * skill = CacheManager::GetSingleton().GetSkillByName(data.skill);
Glen Kaukola commented on 21.11.2009 22:08

Gah! Is there no way to attach files then? the <code> junk didn’t seem to work too well.

Glen Kaukola commented on 22.11.2009 02:10
Glen Kaukola commented on 22.11.2009 02:27

Messed up some indentation in adminmanager.cpp. Here’s a fixed up diff:
http://pastebin.ca/1681795

weltall commented on 22.11.2009 02:57

1) you can do a single diff for both the files
2) you should search also with findobjectbystring (and then check you got an actor) else it’s not possible to use pids or eids

Glen Kaukola commented on 22.11.2009 20:13
weltall commented on 23.11.2009 13:31

committed look ok

Project Manager
Lanarel commented on 27.11.2009 15:40

works fine. “/setskill me copy someplayer” set most of my skills to 0, and some to different values.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing