Transmogger

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Transmogger

      Hallo Zusammen

      Hier möchte ich Euch meinen Transmog NPC zur Verfügung stellen, dessen Transmoggs bleiben bestehen auch wenn Ihr Euch ausgeloggt habt.

      Menü:



      Habt Ihr kein Item in der Tasche bekommt Ihr eine Fehlermeldung:



      Mainhand Auswahl:



      Vorher:



      Transmoggen:





      Transmogs Entfernen:

      ACHTUNG!!! Ihr könnt auch Einzelne Transmogs Entfernen wie Im (Mainhand Auswahl:) Screen zu sehen ist.










      Und Hier das Script und die SQL dazu:



      C Source Code: Transmogger.lua

      1. --[[ Scripted by Batidadekill ]]--
      2. local NPCENTRY = 90013 -- Your NPC's entry
      3. -- Warning! Executes quite some code. Delay in milliseconds. (applies transmogs)
      4. local DELAY = 500 -- 500 (best visual update, very low population), 1000 (good visual update, very low population), 2000+ (slow visual update, medium to high population)
      5. -- DO NOT TOUCH ANYTHING BELOW!
      6. -- Transmog table and functions.
      7. local Transmogs, Hello, Select, AddTransmog, RemoveTransmog, GetValidSources, LoadTransmogs, ApplyTransmogs
      8. -- Key0 is the key for inv_slots table, which contains the slotID. Key0 is also used for the inv_slot_names table
      9. local inv_slots = {0, 2, 4, 5, 6, 7, 8, 9, 14, 15, 16, 17}
      10. local inv_slot_names = {"|TInterface\\Icons\\inv_helmet_99.png:25|t|cffff0000>->|r|cff6666FF Kopf|cffff0000<-<|r", "|TInterface\\Icons\\inv_shoulder_63.png:25|t|cffff0000>->|r|cff6666FF Schulter|cffff0000<-<|r", "|TInterface\\Icons\\inv_chest_cloth_66.png:25|t|cffff0000>->|r|cff6666FF Brust|cffff0000<-<|r", "|TInterface\\Icons\\inv_belt_07.png:25|t|cffff0000>->|r|cff6666FF G\195\188rtel|cffff0000<-<|r", "|TInterface\\Icons\\inv_pants_cloth_27.png:25|t|cffff0000>->|r|cff6666FF Hose|cffff0000<-<|r", "|TInterface\\Icons\\inv_boots_cloth_07.png:25|t|cffff0000>->|r|cff6666FF Schuhe|cffff0000<-<|r", "|TInterface\\Icons\\inv_bracer_10.png:25|t|cffff0000>->|r|cff6666FF Handgelenke|cffff0000<-<|r", "|TInterface\\Icons\\inv_gauntlets_63.png:25|t|cffff0000>->|r|cff6666FF H\195\164nde|cffff0000<-<|r", "|TInterface\\Icons\\inv_misc_cape_naxxramas_03.png:25|t|cffff0000>->|r|cff6666FF Umhang|cffff0000<-<|r", "|TInterface\\Icons\\inv_weapon_glave_01.png:25|t|cffff0000>->|r|cff6666FF Main Hand|cffff0000<-<|r", "|TInterface\\Icons\\inv_misc_book_06.png:25|t|cffff0000>->|r|cff6666FF Off Hand|cffff0000<-<|r", "|TInterface\\Icons\\inv_weapon_bow_39.png:25|t|cffff0000>->|r|cff6666FF Ranged|cffff0000<-<|r"}
      11. local INV_BAG, INV_START, INV_END = 255, 1, #inv_slots
      12. local VISIBLE_ITEM_ENTRY_0 = 283
      13. local BAGS =
      14. {
      15. {BAG = INV_BAG, START = 23, END = 38},
      16. {BAG = 19, START = 0, END = 35},
      17. {BAG = 20, START = 0, END = 35},
      18. {BAG = 21, START = 0, END = 35},
      19. {BAG = 22, START = 0, END = 35},
      20. }
      21. -- bags -1 inventory and backpack, 19-22 other bags
      22. -- slots 0-18 equipment
      23. -- slots 19-22 bags
      24. -- slots 23-38 backpack
      25. -- slots 0-35 other bags
      26. local space = 20
      27. local opt_space = 100
      28. local opt_amount = 13 -- Warning! Do not use over 30
      29. local Data = {}
      30. function Hello(unit, event, player)
      31. Data[tostring(player:GetGUID())] = nil
      32. unit:GossipCreateMenu(100, player, 0)
      33. for Key0 = INV_START, INV_END do
      34. unit:GossipMenuAddItem(3, inv_slot_names[Key0], Key0+space, 0, "", 0)
      35. end
      36. unit:GossipMenuAddItem(4, "|cffff0000>->|rAlle Transmog's entfernen|cffff0000<-<|r", 0, 0, "Wirklich alle Transmog's entfernen?", 0)
      37. unit:GossipSendMenu(player)
      38. end
      39. function Select(unit, event, player, id, intid, code)
      40. local pGUID = tostring(player:GetGUID())
      41. if(intid == 0) then -- remove all transmogs
      42. for Key0 = INV_START, INV_END do
      43. RemoveTransmog(inv_slots[Key0], player)
      44. end
      45. player:SendAreaTriggerMessage("|cff00FF00Transmog's entfernt")
      46. Hello(unit, event, player)
      47. elseif(intid == 1) then
      48. Hello(unit, event, player)
      49. elseif(intid > INV_START and intid <= INV_END+1) then -- remove one transmog
      50. RemoveTransmog(inv_slots[intid-1], player)
      51. player:SendAreaTriggerMessage("|cff00FF00Transmogrification entfernt von "..inv_slot_names[intid-1])
      52. Select(unit, event, player, id, intid+space-1, code)
      53. elseif(intid >= INV_START+space and intid <= INV_END+space) then
      54. local Key0 = intid-space
      55. local sources = GetValidSources(inv_slots[Key0], player)
      56. if(not sources) then
      57. player:SendAreaTriggerMessage("|cff00FF00Du hast f\195\188r diese Aktion keine Items")
      58. Hello(unit, event, player)
      59. elseif(#sources < 2) then
      60. player:SendAreaTriggerMessage("|cff00FF00Kein passendes Item in der Tasche")
      61. Hello(unit, event, player)
      62. else
      63. Data[pGUID] = {Key0, sources}
      64. unit:GossipCreateMenu(100, player, 0)
      65. for k = 1, #sources-1 do
      66. unit:GossipMenuAddItem(4, sources[k]:GetName(), k+INV_END+space, 0, "", 0)
      67. end
      68. unit:GossipMenuAddItem(4, "Transmog's entfernen von "..inv_slot_names[Key0], Key0+1, 0, "Remove transmogrif ication from "..inv_slot_names[Key0].."?", 0)
      69. unit:GossipMenuAddItem(7, ">----> |cffff0000[<<]|rZur\195\188ck|cffff0000[>>]|r <----<..", 1, 0, "", 0)
      70. unit:GossipSendMenu(player)
      71. end
      72. elseif(intid > INV_END+space and intid <= INV_END+space+opt_amount) then
      73. local slot = inv_slots[Data[pGUID][1]]
      74. local target = player:GetInventoryItem(INV_BAG, slot)
      75. local origGUID = Data[pGUID][2][#Data[pGUID][2]] -- no cheating with swapping items on the fly
      76. if(target and tostring(target:GetGUID()) == origGUID) then
      77. local source = Data[pGUID][2][intid-INV_END-space]
      78. if(source and source:GetOwner():IsInWorld() and pGUID == tostring(source:GetOwner():GetGUID())) then
      79. AddTransmog(slot, player, source:GetEntryId())
      80. player:SendAreaTriggerMessage(inv_slot_names[Data[pGUID][1]].." Transmogd")
      81. else
      82. player:SendAreaTriggerMessage("|cff00FF00Item nicht in deiner Tasche")
      83. end
      84. else
      85. player:SendAreaTriggerMessage("|cff00FF00Ausgew\195\164hltes Item ist nicht angelegt")
      86. end
      87. Select(unit, event, player, id, Data[pGUID][1]+space, code)
      88. end
      89. end
      90. function AddTransmog(slot, player, fake)
      91. local item = player:GetInventoryItem(INV_BAG, slot)
      92. if (item) then
      93. local pGUID, iGUID = tostring(player:GetGUID()), tostring(item:GetGUID())
      94. player:SetUInt32Value(VISIBLE_ITEM_ENTRY_0+(slot * 2), fake)
      95. if (not Transmogs[pGUID]) then
      96. Transmogs[pGUID] = {}
      97. end
      98. if (not Transmogs[pGUID][slot]) then
      99. Transmogs[pGUID][slot] = {}
      100. end
      101. Transmogs[pGUID][slot][iGUID] = fake
      102. CharDBQuery('REPLACE INTO Transmog_items (player_GUID, item_GUID, slot, fake) VALUES ("'..pGUID..'", "'..iGUID..'", '..slot..', '..fake..')')
      103. return true
      104. end
      105. return false
      106. end
      107. function RemoveTransmog(slot, player)
      108. local pGUID = tostring(player:GetGUID())
      109. if (Transmogs[pGUID] and Transmogs[pGUID][slot]) then
      110. local item = player:GetInventoryItem(INV_BAG, slot)
      111. if (item) then
      112. local iGUID = tostring(item:GetGUID())
      113. if (Transmogs[pGUID][slot][iGUID]) then
      114. player:SetUInt32Value(VISIBLE_ITEM_ENTRY_0+(slot * 2), item:GetEntryId())
      115. Transmogs[pGUID][slot][iGUID] = nil
      116. CharDBQuery('DELETE FROM Transmog_items WHERE item_GUID = "'..iGUID..'"')
      117. return true
      118. end
      119. end
      120. end
      121. return false
      122. end
      123. function GetValidSources(inv_slot, player) -- returns nil or a table containing the items (can be empty)
      124. local item = player:GetInventoryItem(INV_BAG, inv_slot)
      125. if (not item) then return nil end
      126. local items = {}
      127. local entries = {}
      128. local hasitems = false
      129. for k, DATA in ipairs(BAGS) do
      130. if (DATA.BAG == INV_BAG or player:GetInventoryItem(INV_BAG, DATA.BAG)) then -- skip nonexistant bags
      131. for slot = DATA.START, DATA.END do
      132. local item = player:GetInventoryItem(DATA.BAG, slot)
      133. if(item) then
      134. table.insert(entries, item:GetEntryId())
      135. items[item:GetEntryId()] = item
      136. if (not hasitems) then hasitems = true end
      137. end
      138. end
      139. end
      140. end
      141. if (hasitems) then
      142. local Q = WorldDBQuery("SELECT inventorytype FROM items WHERE entry = "..item:GetEntryId())
      143. if (Q) then
      144. local Q = WorldDBQuery("SELECT entry FROM items WHERE entry IN("..table.concat(entries, ',')..") and inventorytype = "..Q:GetColumn(0):GetULong().." LIMIT "..opt_amount)
      145. if (Q) then
      146. local suitable = {}
      147. for i = 1, Q:GetRowCount() do
      148. table.insert(suitable, items[Q:GetColumn(0):GetULong()]) -- Could possibly add performance if we let this security off
      149. Q:NextRow()
      150. end
      151. table.insert(suitable, tostring(item:GetGUID()))
      152. return suitable
      153. end
      154. end
      155. end
      156. return {}
      157. end
      158. function LoadTransmogs()
      159. local Time = os.time()
      160. print("Loading transmogrifications..")
      161. Transmogs = {}
      162. -- CharDBQuery("DELETE FROM transmog_items WHERE NOT EXISTS (SELECT 1 FROM playeritems WHERE item_GUID = guid) OR NOT EXISTS (SELECT 1 FROM characters WHERE player_GUID = guid)") -- cleanup before load
      163. local Q = CharDBQuery("SELECT player_GUID, item_GUID, slot, fake FROM Transmog_items")
      164. if (Q) then
      165. for i = 1, Q:GetRowCount() do
      166. local pGUID, iGUID, slot, fake = Q:GetColumn(0):GetString(), Q:GetColumn(1):GetString(), Q:GetColumn(2):GetULong(), Q:GetColumn(3):GetULong()
      167. if (not Transmogs[pGUID]) then
      168. Transmogs[pGUID] = {}
      169. end
      170. if (not Transmogs[pGUID][slot]) then
      171. Transmogs[pGUID][slot] = {}
      172. end
      173. Transmogs[pGUID][slot][iGUID] = fake
      174. Q:NextRow()
      175. end
      176. end
      177. print("Transmogrifications loaded in "..(os.time()-Time).." seconds")
      178. end
      179. function ApplyTransmogs() -- minimum looping and checking
      180. local players = GetPlayersInWorld()
      181. for k, player in ipairs(players) do -- loop players
      182. if (player and player:IsInWorld()) then -- player exists
      183. local pGUID = tostring(player:GetGUID())
      184. if (Transmogs[pGUID]) then -- has transmogs
      185. for slot, Data in pairs(Transmogs[pGUID]) do -- looop transmog slots
      186. local item = player:GetInventoryItem(INV_BAG, slot)
      187. if (item) then -- has item in slot
      188. local iGUID = tostring(item:GetGUID())
      189. if(Data[iGUID]) then -- check if item has transmog saved
      190. player:SetUInt32Value(283+(slot * 2), Data[iGUID]) -- apply transmog
      191. end
      192. end
      193. end
      194. end
      195. end
      196. end
      197. end
      198. RegisterUnitGossipEvent(NPCENTRY, 1, Hello)
      199. RegisterUnitGossipEvent(NPCENTRY, 2, Select)
      200. LoadTransmogs()
      201. CreateLuaEvent(ApplyTransmogs, DELAY, 0)
      Display All


      Diese DB Struktur müsst Ihr in Eure Char DB einfügen:



      C Source Code: transmog_items.sql

      1. SET FOREIGN_KEY_CHECKS=0;
      2. -- ----------------------------
      3. -- Table structure for transmog_items
      4. -- ----------------------------
      5. DROP TABLE IF EXISTS `transmog_items`;
      6. CREATE TABLE `transmog_items` (
      7. `player_GUID` text NOT NULL COMMENT 'owner guid',
      8. `item_GUID` text NOT NULL COMMENT 'item guid',
      9. `slot` int(10) unsigned NOT NULL COMMENT 'equip slot',
      10. `fake` int(10) unsigned NOT NULL COMMENT 'fake entry'
      11. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table is used for storing the transmogrification information.\r\nDo not edit this table or it''s contents.';
      Display All

      Viel Spass damit.
      mfg Batida :thumbup:
    • Hallo Batida,

      mir ist aufgefallen das der Transmogifikator Script nicht der deiniger ist, bitte gebe die Quelle und Herkunft an.

      Weil hier ist der Original Script:

      pastebin.com/Rt7xw5pR

      Ich meine jeder kann Quellcode Kopieren, Editiren und es dann sein Eigen nennen.

      Bedenke bitte das leute wie Ich für Online projecte etwas Programmieren und Scripten und dafür bezahlt werden. Klar darf mann den Server rein Schreiben auf dem das läuft und die Rechte für diesen Script gehören auch dem Server aber selbst Free Scripts wurden von jemanden gemacht und haben es verdient Ihren urtühmlichen Coder rein zu schreiben.


      MFG,

      PassCody

      The post was edited 1 time, last by PassCody ().