Exemple #1
0
        public static void AddGuildStone(MabiGuild guild)
        {
            var extra = string.Format("<xml guildid=\"{0}\"{1}/>", guild.Id, guild.HasOption(GuildOptionFlags.Warp) ? " gh_warp=\"true\"" : "");
            var prop = new MabiProp("", guild.Name, extra, (uint)guild.StoneClass, guild.Region, guild.X, guild.Y, guild.Rotation);

            WorldManager.Instance.AddProp(prop);
            WorldManager.Instance.SetPropBehavior(new MabiPropBehavior(prop, GuildstoneTouch));
        }
Exemple #2
0
    public override void OnLoad()
    {
        SetName("_<mini>NPC</mini> Piano Player");
        SetRace(10001);
        SetFace(skin: 18, eye: 0, eyeColor: 49, lip: 48);
        SetLocation(52, 46224, 43756, 206);

        EquipItem(Pocket.Hair, 9200, 0x000000, 0, 0);
        EquipItem(Pocket.Face, 3900, 0, 0, 0);
        EquipItem(Pocket.Armor, 15001, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
        EquipItem(Pocket.Shoe, 220056, 0xFFFFFF, 0xFFFFFF, 0x000000);

        // Spawn piano
        var pos  = NPC.GetPosition();
        var prop = new MabiProp(44311, NPC.Region, pos.X, pos.Y, MabiMath.DirToRad(NPC.Direction));

        prop.State     = "stand";
        prop.ExtraData = string.Format("<xml OWNER='{0}' SITCHAR='{0}'/>", NPC.Id);
        SpawnProp(prop);

        // Sit
        NPC.Temp.SittingProp = prop;
        NPC.State           |= CreatureStates.SitDown;
    }
Exemple #3
0
        private static void GuildstoneTouch(WorldClient client, MabiCreature creature, MabiProp p)
        {
            var match = Regex.Match(p.ExtraData, "guildid=\"([0-9]+)\"");
            if (!match.Success)
                return;

            var guildId = ulong.Parse(match.Groups[1].Value);

            var guild = WorldDb.Instance.GetGuild(guildId);
            if (guild != null)
            {
                if (creature.Guild != null)
                {
                    if (guild.Id == creature.Guild.Id && creature.GuildMember.MemberRank < GuildMemberRank.Applied)
                    {
                        client.Send(new MabiPacket(Op.OpenGuildPanel, creature.Id).PutLong(guild.Id).PutBytes(0, 0, 0));
                    }
                    else
                    {
                        client.Send(
                            new MabiPacket(Op.GuildInfo, creature.Id)
                            .PutLong(guild.Id)
                            .PutString(guild.Name)
                            .PutString(guild.LeaderName)
                            .PutInt(CountAcceptedMembers(guild.Id))
                            .PutString(guild.IntroMessage)
                        );
                    }
                }
                else
                {
                    client.Send(
                        new MabiPacket(Op.GuildInfoNoGuild, creature.Id)
                        .PutLong(guild.Id)
                        .PutStrings(guild.Name)
                        .PutStrings(guild.LeaderName)
                        .PutInt(CountAcceptedMembers(guild.Id))
                        .PutString(guild.IntroMessage)
                    );
                }
            }
        }