Пример #1
0
        public void AddNPCSpawn(UInt32 DBID, UInt32 SpawnID, UInt32 NPCTypeID, string Name)
        {
            NPCSpawn NewSpawn = new NPCSpawn(DBID, SpawnID, NPCTypeID, Name);

            _NPCSpawnList.Add(NewSpawn);
        }
Пример #2
0
        public void GenerateMerchantSQL(NPCSpawnList NPCSL, UInt32 MerchantDBID, bool GenerateSpawns, Action <string> SQLOut)
        {
            MerchantManager mm = PatchDecoder.GetMerchantData(NPCSL);

            if (GenerateSpawns)
            {
                SQLOut("DELETE from merchantlist where merchantid >= @StartingMerchantID and merchantid <= @StartingMerchantID + 999;");
            }

            SQLOut("--");
            SQLOut("-- Merchant Lists");
            SQLOut("-- ");

            foreach (Merchant m in mm.MerchantList)
            {
                UInt32 MerchantSpawnID = m.SpawnID;

                NPCSpawn npc = NPCSL.GetNPC(MerchantSpawnID);

                if (npc == null)
                {
                    continue;
                }

                UInt32 MerchantNPCTypeID = npc.NPCTypeID;

                SQLOut("--");
                SQLOut("-- " + npc.Name);
                SQLOut("-- ");

                bool StartOfPlayerSoldItems = false;

                foreach (MerchantItem mi in m.Items)
                {
                    string Insert = "";

                    if (mi.Quantity >= 0)
                    {
                        if (!StartOfPlayerSoldItems)
                        {
                            StartOfPlayerSoldItems = true;
                            SQLOut("--");
                            SQLOut("-- The items below were more than likely sold to " + npc.Name + " by players. Uncomment them if you want.");
                            SQLOut("--");
                        }

                        Insert += "-- ";
                    }

                    Insert += "INSERT into merchantlist(`merchantid`, `slot`, `item`) VALUES(";

                    Insert += "@StartingMerchantID + " + MerchantDBID + ", " + mi.Slot + ", " + mi.ItemID + "); -- " + mi.Name;

                    SQLOut(Insert);
                }

                if (GenerateSpawns)
                {
                    SQLOut("UPDATE npc_types SET merchant_id = @StartingMerchantID + " + MerchantDBID + " WHERE id = @StartingNPCTypeID + " + MerchantNPCTypeID + ";");
                }

                ++MerchantDBID;
            }
        }
Пример #3
0
        public void AddNPCSpawn(UInt32 DBID, UInt32 SpawnID, UInt32 NPCTypeID, string Name)
        {
            NPCSpawn NewSpawn = new NPCSpawn(DBID, SpawnID, NPCTypeID, Name);

            _NPCSpawnList.Add(NewSpawn);
        }