Example #1
0
        public override bool doProcess(string[] args)
        {
            if (this.client.playerData.freeFuel)
            {
                client.sendCommandMessage("Sorry, you have already received free starter fuel on this server.");
                return false;
            }
            else if (!StarryboundServer.config.freeFuelForNewPlayers)
            {
                client.sendCommandMessage("Sorry, this server does not provide free starter fuel.");
                return false;
            }

            MemoryStream packet = new MemoryStream();
            BinaryWriter packetWrite = new BinaryWriter(packet);

            packetWrite.WriteStarString("solariumore");
            packetWrite.WriteVarUInt32(31); // Seems like it always gives 1 less than the amount entered, so we need 31 to give 30.
            packetWrite.Write((byte)0); //0 length Star::Variant
            client.sendClientPacket(Packet.GiveItem, packet.ToArray());
            client.sendCommandMessage("You have received 30 Solarium Ore as free starter fuel!");

            this.client.playerData.freeFuel = true;
            Users.SaveUser(this.client.playerData);

            return true;
        }
        public override bool doProcess(string[] args)
        {
            if (player.receivedStarterKit)
            {
                client.sendCommandMessage("You have already received your starting items.");
                return false;
            }

            if (StarryboundServer.config.starterItems == null || StarryboundServer.config.starterItems.Length <= 0)
            {
                client.sendCommandMessage("Sorry! This server does not provide any starting items.");
                return false;
            }

            int awardedItems = 0;

            foreach (string item in StarryboundServer.config.starterItems)
            {
                if (String.IsNullOrEmpty(item) || String.IsNullOrWhiteSpace(item))
                {
                    continue;
                }
                string name;
                uint amount;
                if (item.Contains('*'))
                {
                    name = item.Split('*')[0];
                    amount = uint.Parse(item.Split('*')[1]);
                    if (amount <= 0) { continue; }
                }
                else
                {
                    name = item;
                    amount = 1;
                }

                MemoryStream packet = new MemoryStream();
                BinaryWriter packetWrite = new BinaryWriter(packet);

                packetWrite.WriteStarString(name);
                packetWrite.WriteVarUInt32(amount+1);
                packetWrite.Write((byte)0);
                client.sendClientPacket(Packet.GiveItem, packet.ToArray());

                awardedItems++;
            }

            if (awardedItems == 0)
            {
                client.sendCommandMessage("Sorry! This server does not provide any starting items.");
                return false;
            }

            client.sendCommandMessage("You have been given a few starting items to help you on your journey. Good luck!");
            this.client.playerData.receivedStarterKit = true;
            Users.SaveUser(this.client.playerData);

            return true;
        }
        public override void onSend()
        {
            MemoryStream packet = new MemoryStream();
            BinaryWriter packetWrite = new BinaryWriter(packet);

            packetWrite.Write(false);
            packetWrite.WriteVarUInt32(0);
            packetWrite.WriteStarString((string)tmpArray["rejectReason"]);

            this.mClient.sendClientPacket(Packet.ConnectResponse, packet.ToArray());
        }
Example #4
0
        public override bool doProcess(string[] args)
        {
            if (!hasPermission()) { permissionError(); return false; }

            if (args.Length < 2) { showHelpText(); return false; }

            string item = args[0];
            uint count = Convert.ToUInt32(args[1]) + 1;
            if (String.IsNullOrEmpty(item) || count < 1) { showHelpText(); return false; }

            MemoryStream packet = new MemoryStream();
            BinaryWriter packetWrite = new BinaryWriter(packet);

            packetWrite.WriteStarString(item);
            packetWrite.WriteVarUInt32(count);
            packetWrite.Write((byte)0); //0 length Star::Variant
            client.sendClientPacket(Packet.GiveItem, packet.ToArray());
            client.sendCommandMessage("Gave you " + (count - 1) + " " + item);

            return true;
        }