public override void run() { try { Account player = this._client._player; if (player == null) { return; } PlayerTitles titles = player._titles; TitleQ title = TitlesXML.getTitle((int)this.titleId, true); TitleQ title1; TitleQ title2; TitleQ title3; TitlesXML.get3Titles(titles.Equiped1, titles.Equiped2, titles.Equiped3, out title1, out title2, out title3, false); if (this.slotIdx >= (byte)3 || this.titleId >= (byte)45 || (titles == null || title == null) || (title._classId == title1._classId && this.slotIdx != (byte)0 || title._classId == title2._classId && this.slotIdx != (byte)1) || (title._classId == title3._classId && this.slotIdx != (byte)2 || (!titles.Contains(title._flag) || titles.Equiped1 == (int)this.titleId) || (titles.Equiped2 == (int)this.titleId || titles.Equiped3 == (int)this.titleId))) { this.erro = 2147483648U; } else if (TitleManager.getInstance().updateEquipedTitle(titles.ownerId, (int)this.slotIdx, (int)this.titleId)) { titles.SetEquip((int)this.slotIdx, (int)this.titleId); } else { this.erro = 2147483648U; } this._client.SendPacket((SendPacket) new BASE_TITLE_USE_PAK(this.erro)); } catch (Exception ex) { Logger.info("BASE_TITLE_USE_REC: " + ex.ToString()); } }
public override void run() { try { Account p = _client._player; if (p == null) { return; } PlayerTitles t = p._titles; TitleQ titleQ = TitlesXML.getTitle(titleId), eq1, eq2, eq3; TitlesXML.get3Titles(t.Equiped1, t.Equiped2, t.Equiped3, out eq1, out eq2, out eq3, false); if (slotIdx >= 3 || titleId >= 45 || t == null || titleQ == null || titleQ._classId == eq1._classId && slotIdx != 0 || titleQ._classId == eq2._classId && slotIdx != 1 || titleQ._classId == eq3._classId && slotIdx != 2 || !t.Contains(titleQ._flag) || t.Equiped1 == titleId || t.Equiped2 == titleId || t.Equiped3 == titleId) { erro = 0x80000000; } else { if (TitleManager.getInstance().updateEquipedTitle(t.ownerId, slotIdx, titleId)) { t.SetEquip(slotIdx, titleId); } else { erro = 0x80000000; } } _client.SendPacket(new BASE_TITLE_USE_PAK(erro)); } catch (Exception ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[BASE_TITLE_USE_REC.run] Erro fatal!"); } }