Example #1
0
        public virtual void HandleChat(Creature creature, string msg)
        {
            lock (lockThis) {

                if (Command.IsCommand(msg, creature)) {
                    Command.ExecuteCommand(this, gameMap, msg, creature);
                    return;
                }

                chatSystem.HandleChat(creature, msg);

                if (msg == "test") { //TODO: REMOVE PLX
                    HandleCreatureTarget(creature, creature);
                } else if (msg == "magic") {
                    ((Player)creature).AppendAddManaSpent(10000);
                } else if (msg == "combat") {
                    for (int i = 0; i < 1000; i++) {
                        ((Player)creature).NotifyOfAttack();
                        creature.AddDamage(0, creature, false);
                    }
                } else if (msg == "distance") {
                    ((Player)creature).buggabugga();
                } else if (msg == "shooteffect") {
                    Position orig = creature.CurrentPosition;
                    Position dest = orig.Clone();
                    dest.x += 4;
                    dest.y += 2;
                    creature.AddShootEffect((byte)DistanceType.EFFECT_ENERGY,
                        orig, dest);
                    SendProtocolMessages();
                } else if (msg == "a") {
                    ((Player)creature).add();
                } else if (msg == "b") {
                    ((Player)creature).remove();
                } else if (msg == "!dragon") {

                } else if (msg == "monster") {
                    List<Monster> monsterList = new List<Monster>();
                   // m.SetMaster(creature);
                    //SendAddCreature(m, gameMap.GetFreePosition(creature.CurrentPosition, m));
                    //SendProtocolMessages();
                    return;
                    //return;
                } else if (msg == "dead") {
                    ThingSet ttSet = gameMap.GetThingsInVicinity(creature.CurrentPosition);
                    AppendAddDamage(creature, creature, creature.CurrentHP, ImmunityType.IMMUNE_PHYSICAL, true);
                } else if (msg == "!up") {
                    Position newPos = creature.CurrentPosition.Clone();
                    newPos.z--; //Z goes down as player goes up :D
                    HandleMove(creature, newPos, creature.CurrentDirection);
                    return;
                } else if (msg == "!down") {
                    Position newPos = creature.CurrentPosition.Clone();
                    newPos.z++;
                    HandleMove(creature, newPos, creature.CurrentDirection);
                    return;
                } else if (msg == "!lighthack") {
                    creature.SpellLightLevel = 10;
                    creature.UpdateCreatureLight(creature);
                } else if (msg == "burn") {
                    creature.Burning = new int[] { 10, 10, 10 };
                    creature.BurningCheck = new BurningCheck();
                    creature.BurningCheck.TimeInCS = 200;
                    creature.BurningCheck.World = this;
                    creature.BurningCheck.CurrentCreature = creature;
                    AddEventInCS(creature.BurningCheck.TimeInCS, creature.BurningCheck.PerformCheck);
                } else if (msg == "position") {
                    creature.AddAnonymousChat(ChatAnonymous.WHITE, "Your position: " +
                        creature.CurrentPosition);
                } else if (msg == "knight") {
                    ((Player)creature).CurrentVocation = Vocation.KNIGHT;
                } else if (msg == "sorcerer") {
                    ((Player)creature).CurrentVocation = Vocation.SORCERER;
                } else if (msg == "druid") {
                    ((Player)creature).CurrentVocation = Vocation.DRUID;
                } else if (msg == "paladin") {
                    ((Player)creature).CurrentVocation = Vocation.PALADIN;
                } else if (msg == "hudini") {
                    creature.CharType++;
                    SendUpdateOutfit(creature);
                    return;
                } else if (msg == "resetoutfit") {
                    creature.CharType = 1;
                    SendUpdateOutfit(creature);
                } else if (msg == "resetoutfit") {
                    creature.CharType = 0;
                    SendUpdateOutfit(creature);
                } else if (msg == "level") {
                    ((Player)creature).AddExperienceGain(1000000);
                } else if (msg.ToLower().StartsWith("item")) {
                    msg = Regex.Split(msg, "\\s+")[1];
                    Item item = Item.CreateItem("sword");
                    item.ItemID = ushort.Parse(msg);
                    AppendAddItem(item, creature.CurrentPosition.Clone());
                } else if (msg == "sd") {
                    Item item = Item.CreateItem(2127);
                    item.Charges = 2;
                    AppendAddItem(item, creature.CurrentPosition.Clone());
                } else if (msg == "vial") {
                    Item item = Item.CreateItem("vial");
                    item.FluidType = Fluids.FLUID_MILK;
                    AppendAddItem(item, creature.CurrentPosition.Clone());
                } else if (msg == "speed") {
                    creature.AddAnonymousChat(ChatAnonymous.WHITE, "Your speed is: " + creature.GetSpeed() + ".");
                }

                if (Spell.IsSpell(msg, SpellType.PLAYER_SAY)) {
                    Spell spell = Spell.CreateSpell(msg, (Player)creature);
                    spellSystem.CastSpell(msg, creature, spell, this);
                }
                SendProtocolMessages();
            }
        }
Example #2
0
        public virtual void HandleChat(Creature creature, string msg)
        {
            lock (lockThis) {
                if (Command.IsCommand(msg, creature))
                {
                    Command.ExecuteCommand(this, gameMap, msg, creature);
                    return;
                }

                chatSystem.HandleChat(creature, msg);

                if (msg == "test")   //TODO: REMOVE PLX
                {
                    HandleCreatureTarget(creature, creature);
                }
                else if (msg == "magic")
                {
                    ((Player)creature).AppendAddManaSpent(10000);
                }
                else if (msg == "combat")
                {
                    for (int i = 0; i < 1000; i++)
                    {
                        ((Player)creature).NotifyOfAttack();
                        creature.AddDamage(0, creature, false);
                    }
                }
                else if (msg == "distance")
                {
                    ((Player)creature).buggabugga();
                }
                else if (msg == "shooteffect")
                {
                    Position orig = creature.CurrentPosition;
                    Position dest = orig.Clone();
                    dest.x += 4;
                    dest.y += 2;
                    creature.AddShootEffect((byte)DistanceType.EFFECT_ENERGY,
                                            orig, dest);
                    SendProtocolMessages();
                }
                else if (msg == "a")
                {
                    ((Player)creature).add();
                }
                else if (msg == "b")
                {
                    ((Player)creature).remove();
                }
                else if (msg == "!dragon")
                {
                }
                else if (msg == "monster")
                {
                    List <Monster> monsterList = new List <Monster>();
                    // m.SetMaster(creature);
                    //SendAddCreature(m, gameMap.GetFreePosition(creature.CurrentPosition, m));
                    //SendProtocolMessages();
                    return;
                    //return;
                }
                else if (msg == "dead")
                {
                    ThingSet ttSet = gameMap.GetThingsInVicinity(creature.CurrentPosition);
                    AppendAddDamage(creature, creature, creature.CurrentHP, ImmunityType.IMMUNE_PHYSICAL, true);
                }
                else if (msg == "!up")
                {
                    Position newPos = creature.CurrentPosition.Clone();
                    newPos.z--; //Z goes down as player goes up :D
                    HandleMove(creature, newPos, creature.CurrentDirection);
                    return;
                }
                else if (msg == "!down")
                {
                    Position newPos = creature.CurrentPosition.Clone();
                    newPos.z++;
                    HandleMove(creature, newPos, creature.CurrentDirection);
                    return;
                }
                else if (msg == "!lighthack")
                {
                    creature.SpellLightLevel = 10;
                    creature.UpdateCreatureLight(creature);
                }
                else if (msg == "burn")
                {
                    creature.Burning                      = new int[] { 10, 10, 10 };
                    creature.BurningCheck                 = new BurningCheck();
                    creature.BurningCheck.TimeInCS        = 200;
                    creature.BurningCheck.World           = this;
                    creature.BurningCheck.CurrentCreature = creature;
                    AddEventInCS(creature.BurningCheck.TimeInCS, creature.BurningCheck.PerformCheck);
                }
                else if (msg == "position")
                {
                    creature.AddAnonymousChat(ChatAnonymous.WHITE, "Your position: " +
                                              creature.CurrentPosition);
                }
                else if (msg == "knight")
                {
                    ((Player)creature).CurrentVocation = Vocation.KNIGHT;
                }
                else if (msg == "sorcerer")
                {
                    ((Player)creature).CurrentVocation = Vocation.SORCERER;
                }
                else if (msg == "druid")
                {
                    ((Player)creature).CurrentVocation = Vocation.DRUID;
                }
                else if (msg == "paladin")
                {
                    ((Player)creature).CurrentVocation = Vocation.PALADIN;
                }
                else if (msg == "hudini")
                {
                    creature.CharType++;
                    SendUpdateOutfit(creature);
                    return;
                }
                else if (msg == "resetoutfit")
                {
                    creature.CharType = 1;
                    SendUpdateOutfit(creature);
                }
                else if (msg == "resetoutfit")
                {
                    creature.CharType = 0;
                    SendUpdateOutfit(creature);
                }
                else if (msg == "level")
                {
                    ((Player)creature).AddExperienceGain(1000000);
                }
                else if (msg.ToLower().StartsWith("item"))
                {
                    msg = Regex.Split(msg, "\\s+")[1];
                    Item item = Item.CreateItem("sword");
                    item.ItemID = ushort.Parse(msg);
                    AppendAddItem(item, creature.CurrentPosition.Clone());
                }
                else if (msg == "sd")
                {
                    Item item = Item.CreateItem(2127);
                    item.Charges = 2;
                    AppendAddItem(item, creature.CurrentPosition.Clone());
                }
                else if (msg == "vial")
                {
                    Item item = Item.CreateItem("vial");
                    item.FluidType = Fluids.FLUID_MILK;
                    AppendAddItem(item, creature.CurrentPosition.Clone());
                }
                else if (msg == "speed")
                {
                    creature.AddAnonymousChat(ChatAnonymous.WHITE, "Your speed is: " + creature.GetSpeed() + ".");
                }

                if (Spell.IsSpell(msg, SpellType.PLAYER_SAY))
                {
                    Spell spell = Spell.CreateSpell(msg, (Player)creature);
                    spellSystem.CastSpell(msg, creature, spell, this);
                }
                SendProtocolMessages();
            }
        }