public static P_3AF New(Client client, int pGold) { P_3AF tmp = new P_3AF { Header = SHeader.New(0x03AF, Marshal.SizeOf <P_3AF>(), client.ClientId), Gold = pGold }; return(tmp); }
public static void controller(Client client, P_37A p37a) { int gold = client.Character.Mob.Gold + Config.Itemlist[client.Character.Mob.Inventory[p37a.SlotMob].Id].Price; if (gold > 2000000000) { client.Character.Mob.AddItemToCharacter(client, client.Character.Mob.Inventory[p37a.SlotMob], TypeSlot.Inventory, p37a.SlotMob); client.Send(P_101.New("O limite de 2 Bilhao de gold foi atingido!")); } else { client.Character.Mob.RemoveItemToCharacter(client, TypeSlot.Inventory, p37a.SlotMob); //atualiza o gold do mob client.Character.Mob.Gold = gold; client.Send(P_3AF.New(client, client.Character.Mob.Gold)); } }
public static void controller(Client client, P_379 p379) { SMob Npc = Config.MobList.Where(a => a.Mob.ClientId == p379.NpcId).FirstOrDefault().Mob; SItem itemId = Config.MobList.Where(a => a.Mob.ClientId == p379.NpcId).FirstOrDefault().Mob.Inventory[p379.SlotNpc]; SItemList item = Config.Itemlist[itemId.Id]; if (item.Price <= client.Character.Mob.Gold) { int tamanho = 30; if (client.Character.Mob.Andarilho[0].Id != 0) { tamanho += 15; } if (client.Character.Mob.Andarilho[1].Id != 0) { tamanho += 15; } //checa se o inventario esta cheio if (client.Character.Mob.Inventory.Where(a => a.Id != 0).Count() == tamanho) { client.Send(P_101.New("O inventario esta cheio.")); } else { client.Character.Mob.Gold -= item.Price; client.Character.Mob.Inventory[p379.InventorySlot] = itemId; //Adiciona o item no inventorio client.Character.Mob.AddItemToCharacter(client, itemId, TypeSlot.Inventory, p379.InventorySlot); //atualiza o gold do mob client.Send(P_3AF.New(client, client.Character.Mob.Gold)); } } else { client.Send(P_101.New("Gold insuficiente")); } }