GuildGoldUpdate() public static method

public static GuildGoldUpdate ( long info, byte type ) : byte[]
info long
type byte
return byte[]
Exemplo n.º 1
0
 /////////////////////////////////////////////////////////////////////////////////
 // Put gold to storage
 /////////////////////////////////////////////////////////////////////////////////
 void Player_GiveGoldW(byte type, long gold)
 {
     #region Instert gold into storage
     try
     {
         //Check if the user isnt in any state/action that we will not allow.
         if (!Character.State.Die || !Character.Stall.Stallactive || !Character.Alchemy.working || !Character.Position.Walking)
         {
             //Check if the deposit gold is equally or higher then player inventory gold
             if (Character.Information.Gold >= gold)
             {
                 //If the user is storing in normal storage
                 if (!Character.Network.Guild.UsingStorage)
                 {
                     //Set new storage gold plus
                     Character.Account.StorageGold += gold;
                     //Update player inventory gold minus
                     Character.Information.Gold -= gold;
                     //Send update packet
                     client.Send(Packet.UpdateGold(Character.Information.Gold));
                     //Send visual packet of moving gold
                     client.Send(Packet.MoveItem(type, 0, 0, 0, gold, "MOVE_WAREHOUSE_GOLD"));
                     //Save gold information
                     SaveGold();
                 }
                 //If the user is using guild storage
                 else
                 {
                     //Set new storage gold plus
                     Character.Network.Guild.StorageGold += gold;
                     //Update player inventory gold minus
                     Character.Information.Gold -= gold;
                     //Send update packet
                     client.Send(Packet.UpdateGold(Character.Information.Gold));
                     client.Send(Packet.GuildGoldUpdate(Character.Network.Guild.StorageGold, 0x20));
                     client.Send(Packet.GuildStorageGold(Character));
                     //Save gold information
                     SaveGold();
                     //Save guild gold
                     SaveGuildGold();
                 }
             }
             //If gold is to low
             else
             {
                 //Send error message to player
                 client.Send(Packet.IngameMessages(SERVER_UPDATEGOLD, IngameMessages.UIIT_MSG_STRGERR_NOT_ENOUGH_GOLD));
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Deposit gold error {0}", ex);
         Systems.Debugger.Write(ex);
     }
     //Save player information
     SavePlayerInfo();
     #endregion
 }
Exemplo n.º 2
0
 /////////////////////////////////////////////////////////////////////////////////
 // Take gold from storage
 /////////////////////////////////////////////////////////////////////////////////
 void Player_TakeGoldW(byte type, long gold)
 {
     #region Take gold from storage
     try
     {
         //Check if the user isnt in any state/action that we will not allow.
         if (!Character.State.Die || !Character.Stall.Stallactive || !Character.Alchemy.working || !Character.Position.Walking)
         {
             //Normal storage
             if (!Character.Network.Guild.UsingStorage)
             {
                 //Check if the gold is equally or higher to the amount withdrawing
                 if (Character.Account.StorageGold >= gold)
                 {
                     //If ok, reduce the gold from storage
                     Character.Account.StorageGold -= gold;
                     //Add the gold to inventory gold
                     Character.Information.Gold += gold;
                     //Send packet update gold
                     client.Send(Packet.UpdateGold(Character.Information.Gold));
                     //Send visual update
                     client.Send(Packet.MoveItem(type, 0, 0, 0, gold, "MOVE_WAREHOUSE_GOLD"));
                     //Save the gold information
                     SaveGold();
                 }
                 //If gold is to low
                 else
                 {
                     //Send error message to the player.
                     client.Send(Packet.IngameMessages(SERVER_UPDATEGOLD, IngameMessages.UIIT_MSG_STRGERR_NOT_ENOUGH_GOLD));
                 }
             }
             //Guild storage
             else
             {
                 //Check if the gold is equally or higher to the amount withdrawing
                 if (Character.Network.Guild.StorageGold >= gold)
                 {
                     //If ok, reduce the gold from storage
                     Character.Network.Guild.StorageGold -= gold;
                     //Add the gold to inventory gold
                     Character.Information.Gold += gold;
                     //Send packet update gold
                     client.Send(Packet.UpdateGold(Character.Information.Gold));
                     client.Send(Packet.GuildGoldUpdate(Character.Network.Guild.StorageGold, 0x21));
                     client.Send(Packet.GuildStorageGold(Character));
                     //Save the gold information
                     SaveGold();
                     //Save guild gold
                     SaveGuildGold();
                 }
                 //If gold is to low
                 else
                 {
                     //Send error message to the player.
                     client.Send(Packet.IngameMessages(SERVER_UPDATEGOLD, IngameMessages.UIIT_MSG_STRGERR_NOT_ENOUGH_GOLD));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Systems.Debugger.Write(ex);
         Console.WriteLine("Take gold from warehouse error {0}", ex);
     }
     //Save player information
     SavePlayerInfo();
     #endregion
 }