public void RecruitMercenary(NWCreature collocutor, NWCreature mercenary, bool byMoney) { bool res = true; if (byMoney) { int hPrice = (int)mercenary.HirePrice; if (Money < hPrice) { res = false; GlobalVars.nwrWin.ShowText(GlobalVars.nwrWin, BaseLocale.GetStr(RS.rs_NoMoney)); } else { SubMoney(hPrice); collocutor.AddMoney(hPrice); } } if (res) { mercenary.IsMercenary = true; int dist = MathHelper.Distance(Location, mercenary.Location); ExtPoint pt = GetNearestPlace(3, true); if ((dist > (int)Survey) && (!pt.IsEmpty)) { mercenary.CheckTile(false); mercenary.SetPos(pt.X, pt.Y); mercenary.CheckTile(true); } } }
private void OnBtnPay(object sender) { Player player = GlobalVars.nwrGame.Player; int debt; if (Collocutor == null) { debt = 0; } else { debt = player.GetDebt(Collocutor.Name); } int sum; if (player.Money >= debt) { sum = debt; } else { sum = player.Money; } player.SubMoney(sum); player.SubDebt(Collocutor.Name, sum); Collocutor.AddMoney(sum); }
public void TeachDiscipline(NWCreature teacher, int teachableIndex, int curLev) { LeaderBrain party = (LeaderBrain)fBrain; int id = StaticData.dbTeachable[teachableIndex].Id; TeachableKind kind = StaticData.dbTeachable[teachableIndex].Kind; int price = (int)Space.GetTeachablePrice(teachableIndex, curLev); SubMoney(price); teacher.AddMoney(price); switch (kind) { case TeachableKind.Ability: { SetAbility((AbilityID)id, curLev + 1); int num2 = party.Members.Count; for (int i = 1; i < num2; i++) { NWCreature j = party.Members[i]; j.SetAbility((AbilityID)id, curLev + 1); } } break; case TeachableKind.Skill: { SetSkill((SkillID)id, curLev + 1); int num = party.Members.Count; for (int i = 1; i < num; i++) { NWCreature j = party.Members[i]; j.SetSkill((SkillID)id, curLev + 1); } } break; } }