public static bool HandleModifyMoneyCommand(string[] args, CommandGroup handler) { if (args.Count() < 1) return false; Player target = handler.getSelectedPlayer(); if (target == null) return handler.SendErrorMessage(CypherStrings.NoCharSelected); // check online security if (handler.HasLowerSecurity(target, 0)) return false; long addmoney; long.TryParse(args[0], out addmoney); long moneyuser = (long)target.GetMoney(); if (addmoney < 0) { ulong newmoney = (ulong)(moneyuser + addmoney); Log.outDebug(ObjMgr.GetCypherString(CypherStrings.CurrentMoney), moneyuser, addmoney, newmoney); if (newmoney <= 0) { handler.SendSysMessage(CypherStrings.YouTakeAllMoney, handler.GetNameLink(target)); if (handler.needReportToTarget(target)) ChatHandler.SendSysMessage(target, CypherStrings.YoursAllMoneyGone, handler.GetNameLink()); target.SetMoney(0); } else { if (newmoney > PlayerConst.MaxMoneyAmount) newmoney = PlayerConst.MaxMoneyAmount; handler.SendSysMessage(CypherStrings.YouTakeMoney, Math.Abs(addmoney), handler.GetNameLink(target)); if (handler.needReportToTarget(target)) ChatHandler.SendSysMessage(target, CypherStrings.YoursMoneyTaken, handler.GetNameLink(), Math.Abs(addmoney)); target.SetMoney(newmoney); } } else { handler.SendSysMessage( CypherStrings.YouGiveMoney, addmoney, handler.GetNameLink(target)); if (handler.needReportToTarget(target)) ChatHandler.SendSysMessage(target, CypherStrings.YoursMoneyGiven, handler.GetNameLink(), addmoney); if (addmoney >= PlayerConst.MaxMoneyAmount) target.SetMoney(PlayerConst.MaxMoneyAmount); else target.ModifyMoney(addmoney); } Log.outDebug(ObjMgr.GetCypherString(CypherStrings.NewMoney), moneyuser, addmoney, target.GetMoney()); return true; }