public LearnGuildSkillResult TryLearnSkill(GuildSkillId skillId, out GuildSkill skill) { skill = this.Skills[(int)skillId]; if (skill != null) { if (skill.IsMaxLevel) { return(LearnGuildSkillResult.ThisIsTheMaxLevelOfSkill); } if (!this.SubstractGuildPoints(skill.NextLearnCost)) { return(LearnGuildSkillResult.IncifitientPoints); } ++this.Skills[(int)skillId].Level; Asda2GuildHandler.SendGuildSkillStatusChangedResponse(skill, ClanSkillStatus.Learned); } else { if (!this.SubstractGuildPoints(GuildSkillTemplate.Templates[(int)skillId].LearnCosts[1])) { return(LearnGuildSkillResult.IncifitientPoints); } ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() => { GuildSkill guildSkill = new GuildSkill(this, skillId); this.Skills[(int)skillId] = guildSkill; guildSkill.CreateLater(); Asda2GuildHandler.SendGuildSkillStatusChangedResponse(guildSkill, ClanSkillStatus.Learned); })); } return(LearnGuildSkillResult.Ok); }
public LearnGuildSkillResult TryLearnSkill(GuildSkillId skillId, out GuildSkill skill) { skill = Skills[(int)skillId]; if (skill != null) { if (skill.IsMaxLevel) { return(LearnGuildSkillResult.ThisIsTheMaxLevelOfSkill); } //todo get real learn cost levelupSkill if (!SubstractGuildPoints(skill.NextLearnCost)) { return(LearnGuildSkillResult.IncifitientPoints); } Skills[(int)skillId].Level++; } else { if (!SubstractGuildPoints(GuildSkillTemplate.Templates[(int)skillId].LearnCosts[1])) { return(LearnGuildSkillResult.IncifitientPoints); } RealmServer.IOQueue.AddMessage(() => { var s = new GuildSkill(this, skillId); Skills[(int)skillId] = s; s.CreateLater(); }); } Asda2GuildHandler.SendGuildSkillStatusChangedResponse(skill, ClanSkillStatus.Learned); return(LearnGuildSkillResult.Ok); }
public GuildSkill(Guild guild, GuildSkillId id) { Guid = _idGenerator.Next(); Id = id; Guild = guild; GuildId = guild.Id; _level = 1; InitAfterLoad(guild); }
public GuildSkill(Guild guild, GuildSkillId id) { this.Guid = GuildSkill._idGenerator.Next(); this.Id = id; this.Guild = guild; this.GuildId = guild.Id; this._level = (byte)1; this.InitAfterLoad(guild); }