47 _log(CLIENT__MESSAGE,
"SkillMgrService bind request for:");
48 bind_args->
Dump(CLIENT__MESSAGE,
" ");
114 Call_TwoIntegerArgs
args;
115 if( !args.Decode( call.
tuple ) )
117 codelog( SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName() );
121 _log(SKILL__WARNING,
"Called CharStartTrainingSkill for itemID %i in location %i", args.arg1, args.arg2);
127 Call_TwoIntegerArgs
args;
128 if (!args.Decode(&call.
tuple)) {
129 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
135 cRef->UpdateSkillQueueEndTime();
141 Call_InjectSkillIntoBrain
args;
142 if (!args.Decode(&call.
tuple)) {
143 codelog( SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName() );
149 std::map<std::string, uint8> skills;
152 for (
auto cur : args.skills) {
154 if (skill.get() ==
nullptr) {
155 _log( ITEM__ERROR,
"%s: failed to load skill %u for injection.", call.
client->
GetName(), cur);
156 std::string str =
"Invalid Name #";
157 str += std::to_string(cur);
158 skills.emplace(str, 5);
162 skills.emplace(skill->itemName(), cRef->InjectSkillIntoBrain(skill));
169 if (skills.size() == 1) {
171 switch (skills.begin()->second) {
173 case 1: status =
"<color=green>Success.</color>";
break;
174 case 2: status =
"<color=red>Failed:</color> <color=yellow>Prerequisites incomplete.</color>";
break;
175 case 3: status =
"<color=red>Failed:</color> <color=cyan>Skill already known.</color>";
break;
176 case 4: status =
"<color=red>Failed:</color> <color=red>Stack split failure.</color>";
break;
177 case 5: status =
"<color=red>Failed:</color> <color=maroon>Skill loading failure.</color>";
break;
178 default: status =
"<color=red>Failed:</color> <color=red>Unknown Error.</color>";
break;
183 std::ostringstream str;
185 str <<
"The Injection of %u skills for %s has resulted in the following outcome.<br><br>";
187 for (
auto cur : skills) {
188 switch (cur.second) {
190 case 1: status =
"<color=green>Success.</color>";
break;
191 case 2: status =
"<color=red>Failed:</color> <color=yellow>Prerequisites incomplete.</color>";
break;
192 case 3: status =
"<color=red>Failed:</color> <color=cyan>Skill already known.</color>";
break;
193 case 4: status =
"<color=red>Failed:</color> <color=red>Stack split failure.</color>";
break;
194 case 5: status =
"<color=red>Failed:</color> <color=maroon>Skill loading failure.</color>";
break;
195 default: status =
"<color=red>Failed:</color> <color=red>Unknown Error.</color>";
break;
197 str << cur.first <<
" - " << status <<
"<br>";
200 int size = skills.size() * 120;
216 Call_SaveSkillQueue
args;
217 if (!args.Decode(&call.
tuple)) {
218 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
224 _log(SKILL__QUEUE,
"%s(%u) calling SaveSkillQueue()", cRef->name(), cRef->itemID());
225 cRef->ClearSkillQueue(
true);
226 SkillQueue_Element el;
227 std::vector<PyRep*>::const_iterator cur = args.queue->begin(), end = args.queue->end();
228 for (; cur != end; ++cur) {
229 if (!el.Decode(*cur)) {
230 _log(SERVICE__ERROR,
"%s: Failed to decode element of SkillQueue (%u). Skipping.", call.
client->
GetName(), *cur);
233 cRef->AddToSkillQueue( el.typeID, el.level );
236 cRef->UpdateSkillQueueEndTime();
247 Call_SingleIntegerArg
args;
248 if (!args.Decode(&call.
tuple)) {
249 codelog( SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName() );
259 Call_RespecCharacter
args;
260 if (!args.Decode(&call.
tuple)) {
261 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
266 if (cRef->GetSkillInTraining() !=
nullptr)
267 throw UserError (
"RespecSkillInTraining");
273 cRef->SetAttribute(
AttrCharisma, args.charisma * multiplier);
275 cRef->SetAttribute(
AttrMemory, args.memory * multiplier);
277 cRef->SetAttribute(
AttrWillpower, args.willpower * multiplier);
278 cRef->SaveAttributes();
301 Call_SingleIntegerArg
args;
302 if (!args.Decode(&call.
tuple)) {
303 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
315 list->AddItem(tuple);
323 Call_SingleIntegerArg
args;
324 if (!args.Decode(&call.
tuple)) {
325 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
338 Call_SingleIntegerArg
args;
339 if (!args.Decode(&call.
tuple)) {
340 codelog(SERVICE__ERROR,
"%s: Failed to decode arguments.",
GetName());
#define sConfig
A macro for easier access to the singleton.
Dispatcher *const m_dispatch
#define _log(type, fmt,...)
PyRep * GetRespecInfo(uint32 characterId)
void QueueDestinyEvent(PyTuple **multiEvent)
PyTuple * SendSkillQueue()
void SendInfoModalMsg(const char *fmt,...)
PyCallable_Make_InnerDispatcher(SkillMgrService) PyCallable_Make_InnerDispatcher(SkillMgrBound) SkillMgrService
int32 GetCharacterID() const
std::string m_strBoundObjectName
CharacterRef GetChar() const
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
void _SetCallDispatcher(CallDispatcher *d)
void AddToSkillQueue(uint16 typeID, uint8 level)
Dispatcher *const m_dispatch
SkillMgrBound(PyServiceMgr *mgr, CharacterDB &db)
#define codelog(type, fmt,...)
void SetItem(size_t index, PyRep *object)
Stores Python object.
PyServiceMgr *const m_manager
const char * GetName() const
Python object "ccp_exceptions.UserError".
#define PyCallable_REG_CALL(c, m)
virtual PyBoundObject * CreateBoundObject(Client *pClient, const PyRep *bind_args)
PyRep * GetSkillHistory()
Dispatcher *const m_dispatch
bool ReportRespec(uint32 characterId)
void LoadPausedSkillQueue(uint16 typeID)
virtual ~SkillMgrService()
const char * GetName() const