Jump to content

salih

Member
  • Posts

    5
  • Joined

  • Last visited

  • Feedback

    0%

About salih

Informations

  • Gender
    Male
  • Country
    Turkey
  • Nationality
    Turkish

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

salih's Achievements

Contributor

Contributor (5/16)

  • One Year In
  • First Post
  • One Month Later
  • Conversation Starter
  • Week One Done

Recent Badges

0

Reputation

  1. #include "stdafx.h" #include "wheel_of_destiny.h" #include "char.h" #if defined(WHEEL_OF_DESTINY) static constexpr auto WheelItemMax = 16; // vnum, count(max 255), chance(max 255) static constexpr std::tuple<DWORD, std::uint8_t, std::uint8_t> m_Data[WheelItemMax] = { { 11209, 1, 0 }, { 11219, 1, 0 }, { 11229, 1, 0 }, { 11239, 1, 0 }, { 11249, 1, 0 }, { 11259, 1, 0 }, { 11269, 1, 0 }, { 11279, 1, 0 }, { 11289, 1, 0 }, { 11299, 1, 0 }, { 19, 1, 100 }, { 279, 1, 0 }, { 299, 1, 0 }, { 29, 1, 0 }, { 39, 1, 0 }, { 49, 1, 0 }, }; static constexpr auto ItemVnum = 5000; // item static constexpr auto ItemCount = 1; // Gerekli miktar CWheelDestiny::CWheelDestiny(LPCHARACTER m_ch) : ch(m_ch), gift_vnum(0), gift_count(1), turn_count(0) { for (auto i = 0; i < WheelItemMax; i++) ch->ChatPacket(CHAT_TYPE_COMMAND, "BINARY_WHEEL_ICON %lu %d %d", std::get<0>(m_Data[i]), std::get<1>(m_Data[i]), i); ch->ChatPacket(CHAT_TYPE_COMMAND, "BINARY_WHEEL_OPEN %d %d", ItemVnum, ch->GetWheelFreeCount()); } CWheelDestiny::~CWheelDestiny() { if (GetGiftVnum()) sys_log(0, "<CWheelDestiny> player(%s) didn't get his gift(vnum: %lu(%d.x))!!", ch->GetName(), GetGiftVnum(), GetGiftCount()); } template <typename T> std::string NumberToMoneyString(T val) { constexpr int comma = 3; auto str = std::to_string(val); auto pos = static_cast<int>(str.length()) - comma; while (pos > 0) { str.insert(pos, "."); pos -= comma; } return str; } void CWheelDestiny::TurnWheel() { if (GetGiftVnum()) { ch->ChatPacket(CHAT_TYPE_INFO, "Wait motherfucker!"); return; } const auto WheelFreeCount = ch->GetWheelFreeCount(); const auto ItemCountPlayer = ch->CountSpecifyItem(ItemVnum); if (WheelFreeCount < 1 && ItemCountPlayer < ItemCount) { ch->ChatPacket(CHAT_TYPE_INFO, "You need %d of item %d for <Turning Wheel>", ItemCount, ItemVnum); return; } auto Rand = PickAGift(); if (Rand == -1) { sys_err("CWheelDestiny::TurnWheel() Error Pick Gift (%s)", ch->GetName()); return; } if (WheelFreeCount > 0) { ch->SetWheelFreeCount(-1); ch->ChatPacket(CHAT_TYPE_INFO, "FREE"); } else { ch->RemoveSpecifyItem(ItemVnum, ItemCount); } // vnum, count, spin count, pos ch->ChatPacket(CHAT_TYPE_COMMAND, "BINARY_WHEEL_TURN %lu %d %d %d", GetGiftVnum(), GetGiftCount(), number(1, 8), Rand); turn_count++; } std::uint8_t CWheelDestiny::GetChance() const { #undef max const auto TurnCount = GetTurnCount(); if (TurnCount >= 10 && TurnCount < 25) return 25; if (TurnCount >= 25 && TurnCount < 40) return 50; if (TurnCount >= 40) return std::numeric_limits<std::uint8_t>::max(); // 255 return 0; } int CWheelDestiny::PickAGift() { const auto Chance = GetChance(); while (true) { const auto rand_pos = number(0, WheelItemMax - 1); const auto& [item, count, m_chance] = m_Data[rand_pos]; if (Chance >= m_chance) { SetGift(item, count); return rand_pos; } } return -1; // error } void CWheelDestiny::SetGift(const DWORD vnum, const std::uint8_t count) { gift_vnum = vnum; gift_count = count; } void CWheelDestiny::GiveMyFuckingGift() { const auto GiftVnum = GetGiftVnum(); if (GiftVnum) { ch->AutoGiveItem(GiftVnum, GetGiftCount()); SetGift(0, 1); // reset } else sys_err("Dude, where is the gift_vnum? <player: %s>", ch->GetName()); } DWORD CWheelDestiny::GetGiftVnum() const { return gift_vnum; } std::uint8_t CWheelDestiny::GetGiftCount() const { return gift_count; } std::uint16_t CWheelDestiny::GetTurnCount() const { return turn_count; } #endif
  2. import ui import wndMgr import renderTarget import app import chr import player import item import constInfo class RenderTarget(ui.ScriptWindow): RENDER_TARGET_INDEX = 1 Window = None def __init__(self): ui.ScriptWindow.__init__(self) self.max_pos_x = wndMgr.GetScreenWidth() self.max_pos_y = wndMgr.GetScreenHeight() self.Initialize() self.Init() def Initialize(self): self.interface = None @staticmethod def Get(): if RenderTarget.Window == None: RenderTarget.Window = RenderTarget() return RenderTarget.Window def __del__(self): ui.ScriptWindow.__del__(self) self.Initialize() def DisplayUser(self, vRace=0, vItemWeapon=0, vItemArmor=0, vItemHair=0, vItemSash=0, slotIndex = -1): renderTarget.SetBackground(self.RENDER_TARGET_INDEX, "d:/ymir work/ui/render_target.png") renderTarget.SetVisibility(self.RENDER_TARGET_INDEX, True) renderTarget.SelectModel(self.RENDER_TARGET_INDEX, vRace) renderTarget.ResetSettings(self.RENDER_TARGET_INDEX) renderTarget.SetEffect(self.RENDER_TARGET_INDEX) if vRace > 8: return playerRace = player.GetRace() if vItemArmor != 0: renderTarget.SetArmor(self.RENDER_TARGET_INDEX, vItemArmor) else: if playerRace == vRace: if player.GetItemIndex(item.COSTUME_SLOT_START) == 0: renderTarget.SetArmor(self.RENDER_TARGET_INDEX, player.GetItemIndex(player.EQUIPMENT_SLOT_START)) else: renderTarget.SetArmor(self.RENDER_TARGET_INDEX, player.GetItemIndex(item.COSTUME_SLOT_START)) else: renderTarget.SetArmor(self.RENDER_TARGET_INDEX, 0) if vItemWeapon != 0: renderTarget.SetWeapon(self.RENDER_TARGET_INDEX, vItemWeapon) else: if playerRace == vRace: if player.GetItemIndex(item.COSTUME_SLOT_WEAPON) == 0: renderTarget.SetWeapon(self.RENDER_TARGET_INDEX, player.GetItemIndex(player.EQUIPMENT_SLOT_START+4)) else: renderTarget.SetWeapon(self.RENDER_TARGET_INDEX, player.GetItemIndex(item.COSTUME_SLOT_WEAPON)) else: renderTarget.SetWeapon(self.RENDER_TARGET_INDEX, 0) if vItemHair != 0: renderTarget.SetHair(self.RENDER_TARGET_INDEX, vItemHair) else: if playerRace == vRace: renderTarget.SetHair(self.RENDER_TARGET_INDEX, chr.GetHair()) else: renderTarget.SetHair(self.RENDER_TARGET_INDEX, 0) if vItemSash != 0: renderTarget.SetSash(self.RENDER_TARGET_INDEX, vItemSash) else: if playerRace == vRace: renderTarget.SetSash(self.RENDER_TARGET_INDEX, player.GetItemIndex(item.COSTUME_SLOT_START+6)) else: renderTarget.SetSash(self.RENDER_TARGET_INDEX, 0) def Init(self): try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "uiscript/RenderTargetWindow.py") except: import exception exception.Abort("RenderTargetWindow.LoadDialog.LoadScript") try: self.titleBar = self.GetChild("TitleBar") self.titleBar.CloseButton("show") self.titleBar.SetCloseEvent(self.Close) self.board = self.GetChild("board") self.RenderTarget = self.GetChild("RenderTarget") self.buttons = { "moveUp" : self.GetChild("mvUpCmrBtn"), "moveDown" : self.GetChild("mvDownCmrBtn"), "rotateLeft" : self.GetChild("rotLeftBtn"), "rotateRight" : self.GetChild("rotRightBtn"), "moveReset" : self.GetChild("mvResetBtn"), "zoomIn" : self.GetChild("zumInBtn"), "zoomOut" : self.GetChild("zumOutBtn"), } self.buttons["moveUp"].SetEvent(ui.__mem_func__(self.__ModelUpDownCameraProgress)) self.buttons["moveDown"].SetEvent(ui.__mem_func__(self.__ModelUpDownCameraProgress)) self.buttons["rotateLeft"].SetEvent(ui.__mem_func__(self.__ModelRotationProgress)) self.buttons["rotateRight"].SetEvent(ui.__mem_func__(self.__ModelRotationProgress)) self.buttons["moveReset"].SetEvent(ui.__mem_func__(self.__ResetSettings)) self.buttons["zoomIn"].SetEvent(ui.__mem_func__(self.__ModelZoomProgress)) self.buttons["zoomOut"].SetEvent(ui.__mem_func__(self.__ModelZoomProgress)) self.SetCenterPosition() except: import exception exception.Abort("RenderTargetWindow.LoadDialog.BindObject") def BindInterface(self, interface): self.interface = interface def Destroy(self): self.Close() self.Initialize() def Close(self): self.Hide() def Open(self): self.Show() self.SetTop() def OnPressEscapeKey(self): self.Close() def MINMAX(self, min, value, max): if value < min: return min elif value > max: return max else: return value def OnUpdate(self): self.__ModelUpDownCameraProgress() self.__ModelRotationProgress() self.__ModelZoomProgress() x, y = self.GetGlobalPosition() pos_x = self.MINMAX(0, x, self.max_pos_x) pos_y = self.MINMAX(0, y, self.max_pos_y) self.SetPosition(pos_x, pos_y) def __ModelUpDownCameraProgress(self): if self.buttons["moveUp"].IsDown(): renderTarget.SetRenderingPosition(self.RENDER_TARGET_INDEX, False) if self.buttons["moveDown"].IsDown(): renderTarget.SetRenderingPosition(self.RENDER_TARGET_INDEX, True) def __ModelRotationProgress(self): if self.buttons["rotateLeft"].IsDown(): renderTarget.SetMove(self.RENDER_TARGET_INDEX, False) if self.buttons["rotateRight"].IsDown(): renderTarget.SetMove(self.RENDER_TARGET_INDEX, True) def __ModelZoomProgress(self): if self.buttons["zoomIn"].IsDown(): renderTarget.SetZoom(self.RENDER_TARGET_INDEX, True) if self.buttons["zoomOut"].IsDown(): renderTarget.SetZoom(self.RENDER_TARGET_INDEX, False) def __ResetSettings(self): renderTarget.ResetSettings(self.RENDER_TARGET_INDEX)
  3. When you try to open the chest empty, it gives the core, can you help? [Hidden Content]
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.